1

我正在尝试使用 ipython 作为我在 linux 中的默认 shell。%rehashx 在启动时执行,因此可以访问 shell 路径中的命令。有两个问题:

  1. 包含“+”的文件名不能自动补全
  2. 不能执行包含“+”的命令

例如:

g++ x.cpp
#---------------------------------------------------------------------------
#NameError                                 Traceback (most recent call last)
#<ipython-input-2-6f1048d865c4> in <module>()
#----> 1 g++ x.cpp                                                                             
#                                                                                              
#NameError: name 'g' is not defined 
4

1 回答 1

1

在这种情况下,ipython 无法判断您是要运行命令还是 python 代码,它会将其解释为 python 代码。为了帮助它意识到这实际上是您正在尝试运行的命令,请在其前面加上“ !”。

!g++ x+6.cpp
g++: x+6.cpp: No such file or directory
于 2013-05-11T11:26:16.393 回答