博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
windows下pip配置
阅读量:7238 次
发布时间:2019-06-29

本文共 2029 字,大约阅读时间需要 6 分钟。

hot3.png

简介

  pip用于python包的安装,类似于Redhat下的yum、Ubuntu下的apt-get,可以解决安装包依赖的问题,非常方便。这里,我们主要讲下windows下的配置。

配置文件路径

  有多个路径可以配置pip,如果不存在该路径,可以自行创建。

  1. 每个用户的配置路径:%APPDATA%\pip\pip.ini或者%HOME%\pip\pip.ini。其中,%APPDATA%和%HOME%的值可以在命令行中通过echo命令来打印出具体的值,从而进行配置。 
  2. 通用路径:win7下为C:\ProgramData\pip\pip.ini,win XP下为C:\Documents and Settings\All Users\Application Data\pip\pip.ini。其中,win7下为隐藏文件。
  3. 另外,还可以通过环境变量PIP_CONFIG_FILE来指定配置文件的路径。

配置文件内容

  只要pip命令中出现的选项都可以配置在配置文件中,比如直接输入pip命令,会提示以下选项,那么这些选项都可以卸载配置文件中。

General Options:  --log 
Path to a verbose appending log. --proxy
Specify a proxy in the form [user:passwd@]proxy.server:port. --retries
Maximum number of retries each connection should attempt (default 5 times). --timeout
Set the socket timeout (default 120.0 seconds). --exists-action
Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup. --trusted-host
Mark this host as trusted, even though it does not have valid or any HTTPS. --cert
Path to alternate CA bundle. --client-cert
Path to SSL client certificate, a single file containing the private key and the certificate in PEM format. --cache-dir
Store the cache data in
. --no-cache-dir Disable the cache. --disable-pip-version-check Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.

  这些选项是直接输入pip命令得到,所以归为General Options,在配置文件中,就要部署在global选项下,示例如下:

[global]index-url = http://pypi.douban.com/simpletrusted-host = pypi.douban.comdisable-pip-version-check = truetimeout = 120

  输入命令pip help install,就会提示pip install支持的所有选项,在配置文件中,就要部署在install选项下,示例如下:

[install]ignore-installed = trueno-dependencies = yes

  pip支持install、download、uninstall、freeze、list、show、search、wheel、hash、completion等多条子命令,这些都可以分别配置。

转载于:https://my.oschina.net/styshoo/blog/758213

你可能感兴趣的文章
leetcode-Palindrome Partitioning II
查看>>
php 下载已经上传好的excel文件出现乱码------解决办法
查看>>
判断单选框选中不成功,$("#xx").attr("checked")undefined
查看>>
React 实现一个漂亮的 Table
查看>>
mysql函数替换域名
查看>>
HDU 1025--LIS算法
查看>>
docker容器访问宿主机IP
查看>>
python- - 函数 - - 迭代器和生成器
查看>>
WebService连接sql serever并使用Android端访问数据
查看>>
无service.bat的tomcat服务怎么设置自启动
查看>>
OpenCV——IplImage
查看>>
源码安装部署redis
查看>>
windows github 下载慢 修改hosts
查看>>
HTML布局规范
查看>>
关于java加法的编写
查看>>
第七周编程总结
查看>>
CocoaPods的安装使用和常见问题
查看>>
计算机科学,大一学生怎样来爱你(文&PPT)
查看>>
老男孩在创业及培训中28条教导学生感悟语录分享!
查看>>
老板不在,你不得不做出越权的决定,咋办?(考试题系列)
查看>>