当前位置:   article > 正文

python换源之pip.conf

pip.conf

一次性python换源可以添加-i选项:

pip install 包名 -i http://源地址

保存为设置文件pip.conf:

官方文档:User Guide - pip documentation v21.1.3 (pypa.io)

https://pip.pypa.io/en/stable/user_guide/#configuration

pip允许将所有的默认选项保存为一个ini格式的配置文件pip.conf

---------以下来源于官方文档------------------

Per-user:

  • On Unix the default configuration file is: $HOME/.config/pip/pip.conf which respects the XDG_CONFIG_HOME environment variable.

  • On macOS the configuration file is $HOME/Library/Application Support/pip/pip.conf if directory $HOME/Library/Application Support/pip exists else $HOME/.config/pip/pip.conf.

  • On Windows the configuration file is %APPDATA%\pip\pip.ini.

There is also a legacy per-user configuration file which is also respected. To find its location:

  • On Unix and macOS the configuration file is: $HOME/.pip/pip.conf

  • On Windows the configuration file is: %HOME%\pip\pip.ini

You can set a custom path location for this config file using the environment variable PIP_CONFIG_FILE.

Inside a virtualenv:

  • On Unix and macOS the file is $VIRTUAL_ENV/pip.conf

  • On Windows the file is: %VIRTUAL_ENV%\pip.ini

Global:

  • On Unix the file may be located in /etc/pip.conf. Alternatively it may be in a “pip” subdirectory of any of the paths set in the environment variable XDG_CONFIG_DIRS (if it exists), for example /etc/xdg/pip/pip.conf.

  • On macOS the file is: /Library/Application Support/pip/pip.conf

  • On Windows XP the file is: C:\Documents and Settings\All Users\Application Data\pip\pip.ini

  • On Windows 7 and later the file is hidden, but writeable at C:\ProgramData\pip\pip.ini

  • Global configuration is not supported on Windows Vista.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/289514
推荐阅读
相关标签
  

闽ICP备14008679号