virtualenv 环境安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了virtualenv 环境安装相关的知识,希望对你有一定的参考价值。
# Python 2.7.6:
wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall
# Python 3.3.5:
wget http://python.org/ftp/python/3.3.5/Python-3.3.5.tar.xz
tar xf Python-3.3.5.tar.xz
cd Python-3.3.5
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall
-------------------------------------------------start
在virtualenv-15.1.0目录下:
[email protected]:~/mydocument/virtualenv-15.1.0$ python setup.py build
[email protected]:~/mydocument/virtualenv-15.1.0$ sudo python setup.py install
用 python2.7创建环境myenv2.7
[email protected]:~/mydocument/virtualenv-15.1.0$ virtualenv -p python2.7 myenv2.7
# Activate the my27project sandbox and check the version of the default Python interpreter in it:
source my27project/bin/activate
python --version
# This will show Python 2.7.6
deactivate
# Activate the my33project sandbox and check the version of the default Python interpreter in it:
source my33project/bin/activate
python --version
# This will show Python 3.3.5
deactivate
把Django安装文件放在myenv2.7 目录下:
source myenv2.7/bin/activate
tar xzvf Django-1.9.11.tar.gz
python setup.py build
python setup.py install
django-admin --help (验证是否安装成功)
django-admin startproject mysite
python manage.py runserver 0.0.0.0:8000 (0.0.0.0表示访问真实地址)
以上是关于virtualenv 环境安装的主要内容,如果未能解决你的问题,请参考以下文章
windows下python虚拟环境virtualenv安装和使用