1. 下载源码:
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
wget http://mirrors.sohu.com/python/3.6.4/Python-3.6.4.tgz
2. 解压并编译:
1 # cd Python-3.5.0 2 # ./configure --prefix=/Data/apps/Python3 --enable-shared 3 # make && make install 4 # ln -s /Data/apps/Python3/bin/python3 /usr/bin/python3 5 # echo /Data/apps/Python3/lib >> /etc/ld.so.conf.d/python.conf 6 # ldconfig
3. 安装virtualenv
1 # ln -s /Data/apps/Python3/bin/pip3 /usr/bin/pip3 2 # pip3 install virtualenv 3 # cd /Data/apps/ 4 # ln -s /Data/apps/Python3/bin/virtualenv /usr/bin/virtualenv 5 # virtualenv -p /Data/apps/Python3/bin/python3 ENV3 6 # cd ENV3/ 7 # ls 8 bin include lib pip-selfcheck.json
4. virtualenv使用
1 # source bin/activate #激活env,以后安装的包全部在ENV3里,与系统隔离开 2 # # deactivate #退出当前环境
5 virtualenvwrapper
由于本人不太喜欢这个程序,感觉也没方便到什么地方,感兴趣的可以自己搞搞。