【python】在Linux中已安装python3.4下安装pip

深度链接 / 2023-12-06 21:48:31 / 277

pip是一个Python包管理工具,如何安装使用pip?

1、使用安装包安装pip

#上python官网下载,下载页面:https://pypi.python.org/pypi/pip#downloads
#下载
[root@wrx pip-9.0.1]# wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9
#下载完后解压
tar -zxvf pip-9.0.1.tar.gz
#进入pip-9.0.1目录
[root@wrx python]# cd pip-9.0.1
#安装
[root@wrx pip-9.0.1]# python3 setup.py install

2、使用yum安装

#查询是否有相应安装包
[root@wrx python3]# yum list python-pip*
#安装
[root@wrx python3]# yum install python-pip

3、更新pip

[root@wrx python3]# pip install -U pip

4、pip使用

#安装PyPI
#如安装pytesseract
[root@wrx pip-9.0.1]# pip install pytesseract

#查看具体安装文件
[root@wrx pip-9.0.1]# pip show --files pytesseract
Name: Pillow
Version: 4.1.1
Summary: Python Imaging Library (Fork)
Home-page: https://python-pillow.org
Author: Alex Clark (Fork Author)
Author-email: aclark@aclark.net
License: Standard PIL License
Location: /usr/local/lib/python3.4/site-packages
Requires: olefile
Files:………………

#查看需要更新的包
[root@wrx pip-9.0.1]# pip list --outdated

#升级
[root@wrx pip-9.0.1]# pip install --upgrade pytesseract

#卸载
[root@wrx pip-9.0.1]# pip uninstall pytesseract


注:

pip依赖ssl,因此在安装Python时需要安装openssl

[root@wrx Python-3.5.4]# yum -y install openssl*