centos 安裝配置python虛擬環境、pippython
1.安裝pip包安裝工具
# 系統默認源沒有pip安裝包
[root@localhost python]# yum install python-pip
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: repos.dfw.quadranet.com
* extras: sjc.edge.kernel.org
* updates: mirror.hmc.edu
No package python-pip available.
Error: Nothing to do
# 安裝epel源
[root@localhost python]# yum -y install epel-release
# 再次安裝
[root@localhost python]# yum install python-pip
.....
Installed:
python2-pip.noarch 0:8.1.2-6.el7 centos
Complete!
# 安裝成功ide
2.安裝virtualenv
2.1 使用pip安裝virtualenv
[root@localhost python]# pip install virtualenv
若是提示You should consider upgrading via the 'pip install --upgrade pip' command.
就執行pip install --upgrade pip更新後再安裝便可
2.2 使用yum安裝virtualenv
[root@localhost python]# yum install python-virtualenv工具
3.配置python虛擬環境
# 建立名爲env1的虛擬環境
[root@localhost python]# virtualenv env1ip
# 進入虛擬環境
[root@localhost python]# source env1/bin/activate
(env1) [root@localhost python]#pip
# 退出虛擬環境
(env1) [root@localhost python]# deactivate
[root@localhost python]# ast