配置 pip 以从 pypi.python.org 获取丢失的包
configure pip to get missing package from pypi.python.org
我有本地 pypi
服务器。
我在
中设置了它的配置
root@localhost$ cat .pip/pip.conf
[global]
index-url = http://localhost/simple
trusted-host=localhost
我的 pypi
服务器有 paste=2.0.2
但其中一个应用程序需要 paste=2.0.3
。当我签入时 https://pypi.python.org/simple/paste/
它有这个版本。
当我 运行 pip install -r requirements.txt
它给出以下错误。
Collecting paste==2.0.3 (from -r requirements.txt (line 22))
1 location(s) to search for versions of paste:
* http://localhost/simple/paste/
Getting page http://localhost/simple/paste/
Resetting dropped connection: localhost
"GET /simple/paste/ HTTP/1.1" 200 309
Analyzing links from page http://localhost/simple/paste/
Found link http://localhost/packages/Paste-2.0.2-py2-none-any.whl#md5=42d3df8ad533457607903a0ca0922825 (from http://localhost/simple/paste/), version: 2.0.2
Could not find a version that satisfies the requirement paste==2.0.3 (from -r requirements.txt (line 22)) (from versions: 2.0.2)
Cleaning up...
No matching distribution found for paste==2.0.3 (from -r requirements.txt (line 22))
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 276, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/local/lib/python2.7/dist-packages/pip/index.py", line 514, in find_requirement
'No matching distribution found for %s' % req
DistributionNotFound: No matching distribution found for paste==2.0.3 (from -r requirements.txt (line 22))
You are using pip version 9.0.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
我如何配置 pip.conf
,所以当 local
pypi 上没有特定编号的包时,它将搜索 pypi.python.org
?
您需要设置
[global]
extra-index-url = https://pypi.python.org
在您的 ~/.pip/pip.conf 文件中 documentation
此外,您可以使用以下参数启动 pypi 服务器
--fallback-url FALLBACK_URL
for packages not found in the local index, this URL will be used to
redirect to (default: http://pypi.python.org/simple)
我有本地 pypi
服务器。
我在
中设置了它的配置root@localhost$ cat .pip/pip.conf
[global]
index-url = http://localhost/simple
trusted-host=localhost
我的 pypi
服务器有 paste=2.0.2
但其中一个应用程序需要 paste=2.0.3
。当我签入时 https://pypi.python.org/simple/paste/
它有这个版本。
当我 运行 pip install -r requirements.txt
它给出以下错误。
Collecting paste==2.0.3 (from -r requirements.txt (line 22))
1 location(s) to search for versions of paste:
* http://localhost/simple/paste/
Getting page http://localhost/simple/paste/
Resetting dropped connection: localhost
"GET /simple/paste/ HTTP/1.1" 200 309
Analyzing links from page http://localhost/simple/paste/
Found link http://localhost/packages/Paste-2.0.2-py2-none-any.whl#md5=42d3df8ad533457607903a0ca0922825 (from http://localhost/simple/paste/), version: 2.0.2
Could not find a version that satisfies the requirement paste==2.0.3 (from -r requirements.txt (line 22)) (from versions: 2.0.2)
Cleaning up...
No matching distribution found for paste==2.0.3 (from -r requirements.txt (line 22))
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 276, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/local/lib/python2.7/dist-packages/pip/index.py", line 514, in find_requirement
'No matching distribution found for %s' % req
DistributionNotFound: No matching distribution found for paste==2.0.3 (from -r requirements.txt (line 22))
You are using pip version 9.0.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
我如何配置 pip.conf
,所以当 local
pypi 上没有特定编号的包时,它将搜索 pypi.python.org
?
您需要设置
[global]
extra-index-url = https://pypi.python.org
在您的 ~/.pip/pip.conf 文件中 documentation
此外,您可以使用以下参数启动 pypi 服务器
--fallback-url FALLBACK_URL
for packages not found in the local index, this URL will be used to
redirect to (default: http://pypi.python.org/simple)