1、pip下载安装
1.1 pip下载
# wget "D:pic/2025-03-05/https://cdn.chuangxiangniao.com/2025/03/20250305160800838.gz" --no-check-certificate# wget "D:pic/2025-03-05/https://cdn.chuangxiangniao.com/2025/03/20250305160800838.gz" --no-check-certificate
登录后复制
1.2 pip安装
# tar -xzvf https://cdn.chuangxiangniao.com/2025/03/20250305160800838.gz# cd pip-1.5.4# python setup.py install# tar -xzvf https://cdn.chuangxiangniao.com/2025/03/20250305160800838.gz# cd pip-1.5.4# python setup.py install
登录后复制
2. pip使用详解
2.1 pip安装包
# pip install SomePackage
登录后复制登录后复制
[...] Successfully installed SomePackage
登录后复制
# pip install SomePackage
登录后复制登录后复制
[...] Successfully installed SomePackage
登录后复制
2.2 pip查看已安装的包
# pip show --files SomePackage
登录后复制登录后复制
Name: SomePackage Version: 1.0 Location: /my/env/lib/pythonx.x/site-packages Files: ../somepackage/__init__.py [...]
登录后复制
# pip show --files SomePackage
登录后复制登录后复制
Name: SomePackage Version: 1.0 Location: /my/env/lib/pythonx.x/site-packages Files: ../somepackage/__init__.py [...]
登录后复制
2.3 pip检查哪些包需要更新
# pip list --outdated
登录后复制登录后复制
SomePackage (Current: 1.0 Latest: 2.0)
登录后复制
# pip list --outdated
登录后复制登录后复制
SomePackage (Current: 1.0 Latest: 2.0)
登录后复制
2.4 pip升级包
# pip install --upgrade SomePackage
登录后复制登录后复制
[...] Found existing installation: SomePackage 1.0 Uninstalling SomePackage: Successfully uninstalled SomePackage Running setup.py install for SomePackage Successfully installed SomePackage
登录后复制
# pip install --upgrade SomePackage
登录后复制登录后复制
[...] Found existing installation: SomePackage 1.0 Uninstalling SomePackage: Successfully uninstalled SomePackage Running setup.py install for SomePackage Successfully installed SomePackage
登录后复制
2.5 pip卸载包
立即学习“Python免费学习笔记(深入)”;
$ pip uninstall SomePackage
登录后复制登录后复制
Uninstalling SomePackage: /my/env/lib/pythonx.x/site-packages/somepackage Proceed (y/n)? y Successfully uninstalled SomePackage
登录后复制
$ pip uninstall SomePackage
登录后复制登录后复制
Uninstalling SomePackage: /my/env/lib/pythonx.x/site-packages/somepackage Proceed (y/n)? y Successfully uninstalled SomePackage
登录后复制
3.使用pip国内源
python使用pip安装模块很方便,可是在国内官方源总是会间歇性的连接不上,其实python在国内也是有安装源的,比如豆瓣,下面是使用方法.
文件路径
linux
~/.pip/pip.conf
登录后复制
文件内容
[global] index-url = http://pypi.douban.com/simple trusted-host = pypi.douban.com
登录后复制
或者使用-i指令:
easy_install -i http://pypi.douban.com/simple/ saltTesting pip install -i http://pypi.douban.com/simple/ saltTesting
登录后复制
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2534976.html