我在我的ubuntu服务器上运行django。在服务器上,有两个不同版本的python,分别是python 2.x和3.x.我使用3.x的请求模块,但服务器默认使用出现错误的2.x的python。怎么解决这个问题?感谢
我用apache服务器运行django,这是配置。
Alias /static/ /python_web/person-blog/mysite/blog/static/
<Directory /python_web/person-blog/mysite/blog/static>
Require all granted
</Directory>
WSGIScriptAlias / /python_web/person-blog/mysite/mysite/wsgi.py
WSGIDaemonProcess xxx.com python-path=/python_web/person-blog/mysite:/python_web/env/lib/python3.4/site-packages
WSGIProcessGroup xxx.com
<Directory /python_web/person-blog/mysite/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
答案 0 :(得分:1)
您将服务器指向正确的python解释器。如何完成取决于您使用的服务器软件。本教程显示了apache配置,靠近页面底部。注意指定的“python-path”。
如果您运行的是apache以外的服务器,那么答案将类似。只需搜索您正在使用的服务器软件和“python interpreter”,您就可以找到答案。