1.必须切换到root权限下。
2.下载get_pip.py.在root下
[root@localhost ~]# wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
3.运行get-pip.py
[root@localhost ~]# python get-pip.py
4.现在就已经完成了pip的安装
5.使用pip命令安装python 沙河环境
[root@localhost ~]# pip install virtualenv
6.建立一个沙盒环境 test1
[root@localhost ~]# virtualenv test1
New python executable in /root/test1/bin/python
Installing setuptools, pip, wheel...done.
7.进入该目录下
[root@localhost ~]# cd test1
8.查看当前目录下的所有文件
[root@localhost ~]# ls -lh
total 16
drwxr-xr-x. 2 root root 4096 Oct 5 07:05 bin
drwxr-xr-x. 2 root root 4096 Oct 5 07:04 include
drwxr-xr-x. 3 root root 4096 Oct 5 07:04 lib
-rw-r--r--. 1 root root 60 Oct 5 07:05 pip-selfcheck.json
9.启动建立的沙盒环境测试项目
[root@localhost ~]# source bin/activate
10.启动成功后,会在前面多出 test1 字样,如下所示
(test1) [root@localhost test1]#
11.退出虚拟沙盒环境
deactivate