CentOS7上Python3.5安装
CentOS7上Python3.5安装
1.下载
https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
2.上传到服务器
3.
yum install gcc openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
4. 解压
tar xf Python-3.5.2.tgz
5. 编译
./configure --prefix=/usr/local/python3
make && make install
6. 安装虚拟化环境
cd /usr/local/python3/bin/
ln -sv /usr/local/python3/bin/pip3 /usr/local/bin/
ln -sv /usr/local/python3/bin/python3 /usr/local/bin/
pip3 install virtualenv -i https://mirrors.ustc.edu.cn/pypi/web/simple
Collecting virtualenv
ln -sv /usr/local/python3/bin/virtualenv /usr/local/bin/
7. 建立python3独立环境
virtualenv -p /usr/local/bin/python3 /py3env
8.激活python3环境
source /py3env/bin/activate
或者
. /py3env/bin/activate
9. 验证python3环境
python
10. 退出独立python3环境使用
deactivate