您现在的位置是:首页 > 文章详情

python:关于pip

日期:2018-09-02点击:425

python pip安装包的一些常用命令:

1 罗列出所有安装过的包:

pip list 或 pip freeze

2 安装包:

2.1 直接安装

$ pip install SomePackage # 默认最新版 $ pip install SomePackage==1.0.4 # 某个指定版 $ pip install 'SomePackage>=1.0.4' # 某个版本以上

2.2 从包列表文件里面依次安装

pip install -r example-requirements.txt 关于 example-requirements.txt:

# ####### example-requirements.txt ####### # ###### Requirements without Version Specifiers ###### nose nose-cov beautifulsoup4 # ###### Requirements with Version Specifiers ###### # See https://www.python.org/dev/peps/pep-0440/#version-specifiers docopt == 0.6.1 # Version Matching. Must be version 0.6.1 keyring >= 4.1.1 # Minimum version 4.1.1 coverage != 3.5 # Version Exclusion. Anything except version 3.5 Mopidy-Dirble ~= 1.1 # Compatible release. Same as >= 1.1, == 1.* # ###### Refer to other requirements files ###### -r other-requirements.txt # # ###### A particular file ###### ./downloads/numpy-1.9.2-cp34-none-win32.whl http://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev1820+49a8884-cp34-none-win_amd64.whl # ###### Additional Requirements without Version Specifiers ###### # Same as 1st section, just here to show that you can put things in any order. rejected green #

2.3 指定安装的源

pip install SomePackage -i https://pypi.tuna.tsinghua.edu.cn/simple

3 升级包

pip install -U SomePackage

pip install --upgrade SomePackage

4 卸载包

pip uninstall SomePackage  或者 pip uninstall -r list.txt

5 显示某个包的信息....包所含文件列表:

pip show -f SomePackage

6 搜索包

pip search keyword

7 查询可升级包

pip list -o

原文链接:https://yq.aliyun.com/articles/633476
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章