[root@docker-01 ~]# yum install -y epel-release [root@docker-01 ~]# yum -y install python-pip python-wheel
方式二:
[root@localhost ~]# curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py [root@localhost ~]# python get-pip.py
# pip install SomePackage [...] Successfully installed SomePackage
如:安装Redis
[root@docker-01 ~]#pip install redis
1 # pip install -r requirements.txt
[root@localhost ~]# mkdir ~/.pip [root@localhost ~]# vi ~/.pip/pip.conf [global] index-url = https://pypi.mirrors.ustc.edu.cn/simple/ [install] trusted-host=pypi.mirrors.ustc.edu.cn
# pip show --files SomePackage Name: SomePackage Version: 1.0 Location: /my/env/lib/pythonx.x/site-packages Files: ../somepackage/__init__.py [...]
1 [root@localhost ~]# pip show --files redis
1 [root@localhost ~]# pip list --outdated 2 SomePackage (Current: 1.0 Latest: 2.0)
1 # pip install --upgrade SomePackage #语法 2 [...] 3 Found existing installation: SomePackage 1.0 4 Uninstalling SomePackage: 5 Successfully uninstalled SomePackage 6 Running setup.py install for SomePackage 7 Successfully installed SomePackage 8 [root@localhost ~]# pip install --upgrade pyudev
1 # pip uninstall SomePackage 2 Uninstalling SomePackage: 3 /my/env/lib/pythonx.x/site-packages/somepackage 4 Proceed (y/n)? y 5 Successfully uninstalled SomePackage 6 [root@localhost ~]# pip uninstall redis #卸载Redis
1 Usage: 2 pip <command> [options] 3 4 Commands: 5 install 安装软件. 6 uninstall 卸载软件. 7 freeze 按着一定格式输出已安装软件列表 8 list 列出已安装软件. 9 show 显示软件详细信息. 10 search 搜索软件,类似yum里的search. 11 wheel Build wheels from your requirements. 12 zip 不推荐. Zip individual packages. 13 unzip 不推荐. Unzip individual packages. 14 bundle 不推荐. Create pybundles. 15 help 当前帮助. 16 17 General Options: 18 -h, --help 显示帮助. 19 -v, --verbose 更多的输出,最多可以使用3次 20 -V, --version 现实版本信息然后退出. 21 -q, --quiet 最少的输出. 22 --log-file <path> 覆盖的方式记录verbose错误日志,默认文件:/root/.pip/pip.log 23 --log <path> 不覆盖记录verbose输出的日志. 24 --proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port. 25 --timeout <sec> 连接超时时间 (默认15秒). 26 --exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup. 27 --cert <path> 证书.
原文:https://www.cnblogs.com/liujunjun/p/12245704.html