简体   繁体   中英

Unable to install packages with pip

My build machine doesn't have internet connection. so i created proxy repository in nexus with name "proxy_repo" which is pointing to https://pypi.org/ . and created ~/.pip/pip.config in build machine.

https://pypi.org/ is allowed to access from build machine through nexus.

content of the pip.conf is as below

[global]
trusted-host=MyPrivate-nexusrepo.com
index = https://MyPrivate-nexusrepo.com/content/repositories/proxy_repo/pypi
index-url = https://MyPrivate-nexusrepo.com/content/repositories/proxy_repo/simple

when i execute any pip command, say "pip -v install django" , i always getting below error. can some one please help?

    Collecting django
  1 location(s) to search for versions of django:
  * https://MyPrivate-nexusrepo.com/content/repositories/proxy_repo/simple/django/
  Getting page https://MyPrivate-nexusrepo.com/content/repositories/proxy_repo/simple/django/
  Looking up "https://MyPrivate-nexusrepo.com/content/repositories/proxy_repo/simple/django/" in the cache
  No cache entry available
  Starting new HTTPS connection (1): MyPrivate-nexusrepo.com
  "GET /content/repositories/proxy_repo/simple/django/ HTTP/1.1" 404 None
  Could not fetch URL https://MyPrivate-nexusrepo.com/content/repositories/proxy_repo/simple/django/: 404 Client Error: Not Found for url: https://MyPrivate-nexusrepo.com/content/repositories/proxy_repo/simple/django/ - skipping
  Could not find a version that satisfies the requirement django (from versions: )
Cleaning up...
No matching distribution found for django

我之前遇到过此问题,通过设置日期和时间来解决我的问题..如果计算机的日期和时间不是最新的,它将阻止从Python.org提取数据

One thing that often trips people up who are running in restricted environments is that access to both of these servers must be allowed through your corporate firewall:

https://pypi.org/

https://files.pythonhosted.org/

The reason for this is that requests made to the first URL often redirect to the second one for the content requested.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM