centos7安装python3.6以及virtualenv

yum安装python3.6

1.安装EPEL和IUS软件源

1
2
yum install epel-release -y
yum install https://centos7.iuscommunity.org/ius-release.rpm -y

2.安装 python 3.6

1
2
yum install python36u -y
yum install python36u-devel -y

3.创建python3连接符

1
ln -s /bin/python3.6 /bin/python3

4.安装pip3

1
yum install python36u-pip -y

5.创建pip3连接符

1
ln -s /bin/pip3.6 /bin/pip3

安装virtualenv 和使用

1.安装virtualenv

1
pip3 install virtualenv

2.使用virtualenv

1
2
3
4
5
6
7
8
9
# 创建虚拟环境所在的文件夹
mkdir -p ~/python_code
mkdir -p ~/python_code/env
# 为目录创建虚拟环境
virtualenv -p python3 ~/python_code/env/
# 激活虚拟环境
source ~/python_code/env/bin/active
# 退出环境
deactivate
李金鹏 wechat
ex. subscribe to my blog by scanning my public wechat account
努力工作,好好赚钱