【发布时间】:2016-02-11 15:27:45
【问题描述】:
我正在尝试在终端 hello.py python 脚本中运行:
#! usr/bin/env python3
print("Hello", "World!")
在终端中调用以下内容(在 hello.py 所在的工作目录中):
$ chmod +x hello.py
$ ./hello.py
我得到:
bash: ./hello.py: usr/bin/env: bad interpreter: No such file or directory
我无法超越它。我在终端中检查了以下内容 (可能需要进一步澄清):
_____________________________________________________________________
$ python3
Python 3.4.2 (default, Oct 8 2014, 10:45:20)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.executable)
/usr/bin/python3
_____________________________________________________________________
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
_____________________________________________________________________
$ which python3
/usr/bin/python3
_____________________________________________________________________
感谢您的澄清!
【问题讨论】:
-
Debian 建议使用解释器的绝对路径,例如
/usr/bin/python3
标签: python linux debian interpreter