安装依赖
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel -y
下载Python-3.6.10.tgz
wget https://www.python.org/ftp/python/3.6.10/Python-3.6.10.tgz
解压安装,并建立软连接
tar zxvf Python-3.6.10.tgz cd Python-3.6.10/ ./configure --prefix=/usr/local/python3 make && make install ln -s /usr/local/python3/bin/python3 /usr/bin/python3 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3 chmod -R 777 /usr/local/python3
添加环境变量
vim ~/.bash_profile
PATH=/usr/bin:/usr/local/bin:$ORACLE_HOME/bin:$HOME/bin:$JAVA_HOME/bin:$PATH; export PATH
安装virtualenv(系统本身自带python2.7,并安装了virtualenv,此时安装python3环境的虚拟环境时可能会报错,因此可以指定目录新安装高版本的virtualenv)
pip3 install --target=/usr/local/python3/lib/python3.6/site-packages virtualenv ln -s /usr/local/python3/lib/python3.6/site-packages/bin/virtualenv /usr/bin/virtualenv3
安装虚拟环境
virtualenv3 -p python3 cbstext2
遇到的问题
解决办法
pip uninstall enum34