Centos7安装Python3,创建python3虚拟环境

Centos7安装Python3,创建python3虚拟环境

1.安装依赖库

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

yum install -y gcc gcc-c++  python-devel cyrus-sasl-plain  cyrus-sasl-devel  cyrus-sasl-gssap

2.下载编译安装python3

wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz

tar -zxvf Python-3.6.8.tgz

cd Python-3.6.8

./configure && make && make install

3.创建python3虚拟环境

mkdir /usr/local/thirdparty
cd /usr/local/thirdparty
python3 -m venv virtualenv_name   #python3 环境

pip install virtualenv
virtualenv -p /usr/bin/python2.7 supervisor  # python2环境

pip install -r requirements.txt # 安装依赖文件

pip freeze >requirements.txt # 生成依赖文件

Shylin

你可能感兴趣的:(centOS,Python)