请问一下如何在部署django的时候,指定python的运行版本?
阿里云默认的是使用python2.7的版本,但是我开发用的python3,但是我部署在apache上,老是运行2.7(因为是默认的),很多包和库都不兼容 很麻烦.
所以特此来求教一下!
伊谢尔伦2017-04-17 17:55:40
Install python3 first
and then set up the soft link
ln -s /usr/bin/python3 /usr/bin/python
PHP中文网2017-04-17 17:55:40
Compile and install Python 3 by yourself, and then use it to install django.
Finally just specify it in the apache configuration file
WSGIScriptAlias / /my/app/path/wsgi.py
WSGIPythonPath /my/app:/path/to/the/virtual/env/lib/python3.3/site-packages
PS: Python 3 support requires Django 1.6+ and mod_wsgi 3.4+
link: http://stackoverflow.com/questions/5930585/how-to-use-python-3-and-django-with-apache/
高洛峰2017-04-17 17:55:40
It is recommended to use virtualenv, you can specify the python version when creating