centos 安装python36 pip19.1 python虚拟环境

1.安装python

# yum install -y python36 python36-devel python36-virtualenv

2.将python3 改为python

# which  python			#(1)获取原来python 的绝对路径   其实是python2
/usr/bin/python	

# which  python3		#(2)获取python3 的绝对路径
/usr/bin/python3

# rm -rf /usr/bin/python	#(3)删除python2
# ln -s /usr/bin/python3 /usr/bin/python	#(4)做软连接

#(5)修改以下两个文件 的第一行 将/usr/bin/python 改为/usr/bin/python2
/bin/yum
/usr/libexec/urlgrabber-ext-down

3.安装pip

# easy_install-3.6 pip

4.安装virtualenvwrapper

# pip install virtualenvwrapper virtualenv --user
# which virtualenv-3
# sudo ln -s /usr/bin/virtualenv-3 /usr/bin/virtualenv

5.修改配置文件是指生效

# 1). 查看virtualenvwrapper.sh 在什么位置
# which virtualenvwrapper.sh
~/.local/bin/virtualenvwrapper.sh

# 2).修改配置文件
# tail -5  ~/.bash_profile
PATH=$PATH:$HOME/.local/bin:$HOME/bin
WORKON_HOME=/cust/python/venv
source /home/wlsadmin/.local/bin/virtualenvwrapper.sh

export PATH WORKON_HOME

# 3).使配置文件生效
# source ~/.bash_profile

6.创建一个虚拟环境

# mkvirtualenv Asset

你可能感兴趣的:(python)