python小问题 - 在阿里云的ubuntu机器上部署django,如何指定python版本?
巴扎黑
巴扎黑 2017-04-17 17:53:40
0
4
675

请问一下如何在部署django的时候,指定python的运行版本?
阿里云默认的是使用python2.7的版本,但是我开发用的python3,但是我部署在apache上,老是运行2.7(因为是默认的),很多包和库都不兼容 很麻烦.

所以特此来求教一下!

巴扎黑
巴扎黑

reply all(4)
伊谢尔伦

Install python3 first
and then set up the soft link

ln -s /usr/bin/python3 /usr/bin/python
洪涛

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/

伊谢尔伦

python3 yourCmd
or you can consider virtualenv

小葫芦

It is recommended to use virtualenv, you can specify the python version when creating

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!