pip安装python库的方法总结
2019-08-02 08:46
597 查看
使用pip安装python库的几种方式
1、使用pip在线安装
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/
2、从源码安装
示例如下:
git clone https://github.com/sphinx-doc/sphinx cd sphinx pip install .
3、从 whl 文件安装
格式如下:
pip install SomePackage.whl
以上就是关于本次知识点的全部内容,感谢大家对脚本之家的支持。
您可能感兴趣的文章:
相关文章推荐
- centos下安装Python包管理工具pip的方法总结
- Python(Windows)下安装各种库的多种方法总结--灵活使用pip
- 本地安装python、pydev、setuptools、pip和Elasticsearch-py客户端方法总结
- ubuntu下python2.7 安装 xlrd、xlwt、pip、 第三方库(library)的简易方法、pip 安装 selenium
- pip的安装,更新,卸载模块以及使用方法 python
- python pip安装方法
- Python_pip——安装方法
- Windows下Python中pip安装Pillow报错总结(转载)
- CentOS下使用yum安装python-pip失败的完美解决方法
- ubuntu下python2.7 安装 xlrd、xlwt、pip、 第三方库(library)的简易方法、pip 安装 selenium
- 记录一下python easy_install和pip安装地址和方法
- pip安装python模块报延时错误的解决方法
- Windows安装Python、pip、easy_install的方法
- win7下python2.7安装 pip,setuptools的正确方法(亲测)
- 多版本Python共存时pip给指定版本的python安装package的方法
- Python使用pip安装报错:is not a supported wheel on this platform的解决方法
- 无法使用pip命令安装python第三方库的原因及解决方法
- python27和python36 共存时安装pip方法,解决python27文件夹下没有script文件方法
- Python - Windows下安装easy_install, pip 及whl文件安装方法
- CentOS 6.4安装pip,CentOS安装python包管理安装工具pip的方法