Python 更新 pip.conf 文件以使用 https
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24353459/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Updating the pip.conf file to use https
提问by Deepend
I am having trouble configuring my pip.conf file to stipulate that PIP should look for downloads from https://pypi.python.org/simple/rather than http://pypi.python.org/simple/
我在配置 pip.conf 文件以规定 PIP 应从https://pypi.python.org/simple/而不是http://pypi.python.org/simple/查找下载时遇到问题
I have a related question posted PIP Could not find any downloads that satisfy the requirement SQLAlchemywhere a couple of people diagnosed what was going wrong. However I am having trouble putting in place the solution.
我有一个相关的问题发布PIP 找不到满足 SQLAlchemy 要求的任何下载,其中有几个人诊断出了什么问题。但是,我在实施解决方案时遇到了麻烦。
I opend my pip.conf file located at /home/user/.pip/pip.conf
using the pip config file documentationI added the below. There is nothing else in the file.
我打开了位于/home/user/.pip/pip.conf
使用pip 配置文件文档的pip.conf 文件,我添加了以下内容。文件中没有其他内容。
[global]
timeout = 60
find-links = https://pypi.python.org/simple/
[install]
find-links = https://pypi.python.org/simple/
After saving an exiting there is no change. I still cannot run commands such as pip install
保存退出后没有任何变化。我仍然无法运行诸如 pip install 之类的命令
$ sudo pip install SQLAlchemy
Downloading/unpacking SQLAlchemy
Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement SQLAlchemy
No distributions at all found for SQLAlchemy
Storing complete log in /home/user/.pip/pip.log
My setup
我的设置
- Ubunto 12.04 VM
- Ubuntu 12.04 虚拟机
采纳答案by Midnighter
You should use index-url = https://pypi.python.org/simple/
rather than find-links
in your config. This will replace the default rather than just adding another option (which is what find-links
does).
您应该使用index-url = https://pypi.python.org/simple/
而不是find-links
在您的配置中。这将替换默认值,而不仅仅是添加另一个选项(这是这样find-links
做的)。
回答by iamkhush
I think your changes are not being used.
我认为您的更改没有被使用。
pip install --find-links=https://pypi.python.org/simple/ SQLAlchemy
works on my system.
pip install --find-links=https://pypi.python.org/simple/ SQLAlchemy
在我的系统上工作。
. The log says it is checking https://pypi.python.org/simple.
. 日志说它正在检查https://pypi.python.org/simple。
回答by Jan Vlcinsky
Update from 2011-04-04 version to latest one
从 2011-04-04 版本更新到最新版本
pip version 1.0 is fairly old, pypi shows date 2011-04-04. Consider installing latest version.
pip 1.0 版本相当旧,pypi 显示日期为 2011-04-04。考虑安装最新版本。
Since 2011 there were some significant changes (security fixes, support for wheel format...)
自 2011 年以来发生了一些重大变化(安全修复、对轮子格式的支持......)
I would first remove completely the pip
installed by apt-get
, incl. cleaning whatever is in directories around. And then install using get-pip.py
as described on pypa.
我会首先完全删除pip
安装的apt-get
,包括。清理周围目录中的任何内容。然后get-pip.py
按照pypa 上的描述进行安装。
I know, that it is often recommended following Linux distribution packages, but with pip it is simply not practical.
我知道,通常建议遵循 Linux 分发包,但使用 pip 根本不实用。
回答by Aaron Shang
From latest guide: https://pip.pypa.io/en/stable/user_guide/#config-file
来自最新指南:https: //pip.pypa.io/en/stable/user_guide/#config-file
The new default configuration file is:
$HOME/.config/pip/pip.conf
Legacy per-user configuration file which is also respected:
On Unix and macOS the configuration file is:
$HOME/.pip/pip.conf
新的默认配置文件是:
$HOME/.config/pip/pip.conf
传统的每用户配置文件也受到尊重:
在 Unix 和 macOS 上,配置文件是:
$HOME/.pip/pip.conf