我正在尝试从命令行运行 Python 脚本,但出现错误
$ python pscan2.py
python: can't open file 'pscan2.py': [Errno 2] No such file or directory
不过,我也有
$ which pscan2.py
/usr/bin/pscan2.py
和
$ echo $PATH
/usr/lib/:/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/MinGW64/bin:/cygdrive/c/Dwimperl/perl/bin:/cygdrive/c/Dwimperl/perl/site/bin:/cygdrive/c/Dwimperl/c/bin:/cygdrive/c/python27: C:/python25:/usr/lib/lapack:/usr/openwin/bin
我可以在 Python 中导入它,因为我已将目录添加到 PYTHONPATH,并且效果很好,但我必须指定目录才能让它在命令行中运行,即使which
可以找到它。
编辑:emacs也找不到它......