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