首页 > 代码库 > virtualenv 环境安装

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目录下:
ubuntu@ubuntu:~/mydocument/virtualenv-15.1.0$ python setup.py build
ubuntu@ubuntu:~/mydocument/virtualenv-15.1.0$ sudo python setup.py install


用 python2.7创建环境myenv2.7
ubuntu@ubuntu:~/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 环境安装