1
我使用PythonAnyhwere作为我的django制作环境。我有一个应该按计划运行的脚本。Shebang for scripts does not working
由于我是在virtualenv中安装的Django,在脚本开始像
#!/usr/bin/env python
activate_this = '/home/myname/.virtualenvs/myenv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
我得到这个错误是
/usr/bin/env python: no such Python interpreter
没问题。所以,我把它改成
#!/usr/bin/env python2.7
然后我
/usr/bin/env python2.7: no such Python interpreter
或
/usr/bin/env python3.4: no such Python interpreter
我说好吧,如果我没有什么家当行呢? 错误日志:
line 1: activate_this: command not found
line 2: syntax error near unexpected token `activate_this,'
line 2: `execfile(activate_this, dict(__file__=activate_this))'
什么是那么的方式吗?
你有没有试过'$哪个python'并把输出放到你的shebang? – valignatev
不可以。我如何在脚本中实现它? – Saphire
只需在终端中执行它即可访问它。没有'$'标记 – valignatev