发布于2019-08-05 11:59 阅读(506) 评论(0) 点赞(3) 收藏(3)
操作系统 : CentOS7.5.1804_x64
Python 版本 : 3.6.8
1.1 安装单个package
格式如下:
pip install SomePackage
示例如下:
比如:pip install scipy 或者指定版本安装:pip install scipy==1.3.0
1.2 安装多个package
示例如下:
pip install -r req.txt
req.txt 可以通过以下命令获取:
pip freeze > req.txt
1.3 在线安装的其它问题
1.3.1 代理问题
如果需要通过代理安装,可以使用如下格式:
pip --proxy=ip:port install SomePackage
1.3.2 pip源问题
如果pip源太慢,可以更换pip源,有以下两种方式:
方式一:通过修改参数临时修改pip源
比如使用阿里云的pip源:
pip install Sphinx -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
方式二:通过修改配置文件永久修改pip源
文件: ~/.pip/pip.conf
比如使用阿里云的pip源:
[admin@localhost .pip]$ cat ~/.pip/pip.conf [global] index-url = http://mirrors.aliyun.com/pypi/simple/ extra-index-url=http://mirrors.aliyun.com/pypi/simple/ [install] trusted-host = mirrors.aliyun.com [admin@localhost .pip]$
也可以使用自建pip源,或者其它公开pip源,比如:
阿里云 http://mirrors.aliyun.com/pypi/simple/ 豆瓣(douban) http://pypi.douban.com/simple/ 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
示例如下:
git clone https://github.com/sphinx-doc/sphinx cd sphinx pip install .
格式如下:
pip install SomePackage.whl
本文github地址:
https://github.com/mike-zhang/mikeBlogEssays/blob/master/2019/20190730_使用pip安装python库的几种方式.rst
欢迎补充
作者:爸爸去挣钱我去幼儿园
链接:https://www.pythonheidong.com/blog/article/4468/9cd3b42654ac3a0f0e10/
来源:python黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
---无人问津也好,技不如人也罢,你都要试着安静下来,去做自己该做的事,而不是让内心的烦躁、焦虑,坏掉你本来就不多的热情和定力
Copyright © 2018-2021 python黑洞网 All Rights Reserved 版权所有,并保留所有权利。 京ICP备18063182号-1
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!