当前位置:网站首页>pip命令和在线、离线安装方法
pip命令和在线、离线安装方法
2022-04-22 14:15:00 【^全村的希望】
1.pip 介绍
pip 是 Python 包管理工具,该工具提供了对Python 包的查找、下载、安装、卸载的功能。
1.1 pip 常用命令
安装包
pip install SomePackage # 最新版本
pip install SomePackage==1.0.4 # 指定版本
pip install ‘SomePackage>=1.0.4’ # 最小版本
升级包
pip install --upgrade SomePackage
升级指定的包,通过使用==, >=, <=, >, < 来指定一个版本号。
卸载包
pip uninstall SomePackage
搜索包
pip search SomePackage
显示安装包信息
pip show
列出已安装的包
pip list
查看可升级的包
pip list -o
1.2 国内镜像
清华大学开源软件镜像站
临时使用:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
2.pip 在线+离线安装
2.1 pip 在线安装
用以下方法来安装:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py # 下载安装脚本
sudo python get-pip.py # 运行安装脚本
注意:用哪个版本的 Python 运行安装脚本,pip 就被关联到哪个版本,如果是 Python3 则执行以下命令:
sudo python3 get-pip.py # 运行安装脚本。
2.2 pip 离线安装
pip官网:https://pypi.python.org/pypi/pip下载pip
或者github 下载: https://github.com/pypa/pip
pip-21.3.1.tar.gz
升级版本跨度太大会出现install报错,用下面的低版本
pip-1.3.tar.gz
移动至/usr/local/下解压,进入目录
执行 python setup.py install 进行安装
注意:用哪个版本的 Python 运行安装脚本,pip 就被关联到哪个版本,如果是 Python3 则执行以下命令:
验证: 查看版本和路径
pip --version
3.常见报错
3.1 python错误:No module named setuptools 解决方法
[root@localhost ]# python setup.py install
Traceback (most recent call last):
File “setup.py”, line 8, in
import setuptools
ImportError: No module named setuptools
字面意思是:没有setuptools的模块,说明python缺少这个模块;
解决方法如下:
下载setuptools包
# wget https://pypi.org/project/setuptools/
解压setuptools包
# tar -xvf setuptools-0.7.3.tar.gz
# cd setuptools-0.7.3.tar.gz
开始执行setuptools安装
# python setup.py install
安装完成;
3.2 python错误:zero length field name in format 解决方法
安装pip时,执行命令python pip install 报错
“{}CMD”.format(os.sep) #在Python 2.7中可以正常运行#“{0}CMD”.format(os.sep) #在Python<=2.6,必须显示指定下标,即便只有一个元素。
修改setup.py 指定下标,即可解决
版权声明
本文为[^全村的希望]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_43091761/article/details/124296307
边栏推荐
猜你喜欢

阻塞队列-

985 official announcement: international ranking is no longer a construction goal!

Thoughts on dealing with high concurrency problems

2022危险化学品经营单位安全管理人员操作证考试题及模拟考试

2022化工自动化控制仪表考试练习题模拟考试平台操作

P2b paper reproduction - point cloud learning record

uniapp转微信小程序报错Cannot read property ‘forceUpdate‘ of undefined - 微信开发者工具报错

Activity preview | on April 23, a number of wonderful openmldb sharing came, which lived up to the good time of the weekend!

Solution to the blank page of small and medium-sized programs running from uniapp to wechat developer tool

PLSQL developer file encoding format setting
随机推荐
leetcode:215. 数组中的第K个最大元素
uniapp运行到小程序模拟器的方法 - uniapp开启微信开发者工具预览支持 - HBuilderX
Linked list ring linked list linked list ring judgment to find the ring in nodes 141 and 142
[finally waiting for you] wechat voice forwarding method - voice message forwarding
[summary of Kunpeng migration and practice Posts] the first play~~
图 钥匙和房间
图的遍历 深度优先DFS 广度优先BFS
Pratique de l'arbre binaire itération récursive de l'arbre binaire 257, 100, 222, 101, 226, 437, 563, 617, 572, 543, | 687
双指针快慢指针||快乐数、寻找重复数202、287、|141、142、143、234、457
獲取數據庫中數值時,數據庫有值,卻為空??
BinaryTree练习 从前序与中序、中序与后序遍历序列构造二叉树||重构二叉树654、105、106
How to get tuphub Today's hot list and heat?
Blocking queue-
Double pointer in the same direction, double pointer, sliding window 3, 594, |27, 26, 80, 83, 82, 611, 187, 643, 674, 209, 438, 567, 424, 76, 30
Eight strange facts about semiconductors
关于半导体的8个奇特事实
CVPR 2022 oral | Dalian University of technology proposes to identify deepbdc with small samples, and the performance of six benchmarks is the best
Error reported by uniapp to wechat developer tool - [wrong content of app.json file] JSON: the sitemap.json file corresponding to ["sitemaplocation"] was not found
What is adapter mode?
When getting the value in the database, the database has a value, but it is empty??