哪一种Python intrpetor我应该投入的.py头? [英] Which Python intrpetor should I be putting in .py header?
问题描述
我想建立一个Ubuntu LAMP服务器。该机器将专用于一个网站,该网站有我工作的几个.py文件。这似乎我有PHP和MySQL运行起来,但阿帕奇似乎没有被执行.py文件(只是下载它们)。
I'm trying to set up an Ubuntu LAMP server. The machine would be dedicated to one site, and the site has a few .py files I'm working on. It would seem I have the PHP and MySQL up and running, but the Apache doesn't seem to be executing the .py files (just downloading them).
然后我发现,似乎有两个相互preters,一个在的/ usr / bin中/ Python的
,一个在的/ usr / local / bin目录/蟒蛇
I then noticed that there seem to be two Interpreters, one at /usr/bin/python
and one at /usr/local/bin/python
哪一个应该我的头是指向?目前,我有!#USR / local / bin目录/蟒蛇
Which one should my headers be pointing to? At the moment I have !#usr/local/bin/python
我注意到,我也可以有apache2.conf一个问题,但我不那么肯定。使用虚拟主机我添加了一个CGI处理程序(并试图的mod_python
),没有运气。我可以张贴了整个vitrual主机从apache2.conf的,这将有助于。
I note that I also could have a problem with apache2.conf, but I'm not so sure. Using a virtual host I added a cgi handler (and tried mod_python
) with no luck. I could post up the whole vitrual host from apache2.conf of that would help.
我已经chkmod + RWX *的.py在站点文件夹。也许我应该分裂成这两个职位,但我认为他们可能是相关的。
I've chkmod +rwx *.py in the site folder. Perhaps I should split this into to two posts, but I think they might be related.
感谢
推荐答案
您可以让环境决定,这应该意味着它会执行所使用的任何可执行文件,当您运行运行蟒蛇
在你的shell:
You can let the environment decide, which should mean it'll execute using whatever executable is run when you run python
in your shell:
#!/usr/bin/env python
# Code goes here
这篇关于哪一种Python intrpetor我应该投入的.py头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!