无法连接下载包

无法连接下载包

我在获取包裹(spicy、stats 等)时遇到问题

我使用 python 并且需要安装新的包,但即使在终端上运行也无法安装。

当我尝试安装 homebrew 时出现以下错误。

curl: (6) Could not resolve host: raw.githubusercontent.com

当我尝试吃辣的时候,我得到了以下结果。

$ conda install spicy
Fetching package metadata: Could not connect to https://repo.continuum.io/pkgs/pro/noarch/
conda install spicy
Fetching package metadata: Could not connect to https://repo.continuum.io/pkgs/pro/noarch/
.Could not connect to https://repo.continuum.io/pkgs/pro/osx-64/
.Could not connect to https://repo.continuum.io/pkgs/free/noarch/
.Could not connect to https://repo.continuum.io/pkgs/free/osx-64/
.
Error: No packages found in current osx-64 channels matching: spicy

Did you mean one of these?

    spacy

You can search for this package on anaconda.org with

    anaconda search -t conda spicy

$ anaconda search -t conda spicy
Using anaconda-server api site https://api.anaconda.org
Run 'anaconda show <USER/PACKAGE>' to get more details:
[ConnectionError] HTTPSConnectionPool(host='api.anaconda.org', port=443): Max retries exceeded with url: /search?type=conda&name=spicy (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x102f28c90>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',)) 
Traceback (most recent call last):
  File "/Users/Carol/anaconda/bin/anaconda", line 6, in <module>
    sys.exit(main())
  File "/Users/Carol/anaconda/lib/python2.7/site-packages/binstar_client/scripts/cli.py", line 93, in main
    description=__doc__, version=version)
  File "/Users/Carol/anaconda/lib/python2.7/site-packages/binstar_client/scripts/cli.py", line 75, in binstar_main
    return args.main(args)
  File "/Users/Carol/anaconda/lib/python2.7/site-packages/binstar_client/commands/search.py", line 14, in search
    packages = binstar.search(args.name, package_type=args.package_type)
  File "/Users/Carol/anaconda/lib/python2.7/site-packages/binstar_client/__init__.py", line 443, in search
    res = self.session.get(url, params={'name':query, 'type':package_type})
  File "/Users/Carol/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 480, in get
    return self.request('GET', url, **kwargs)
  File "/Users/Carol/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/Carol/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/Users/Carol/anaconda/lib/python2.7/site-packages/requests/adapters.py", line 423, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPSConnectionPool(host='api.anaconda.org', port=443): Max retries exceeded with url: /search?type=conda&name=spicy (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x102f28c90>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))



$ conda info
Current conda install:

             platform : osx-64
        conda version : 3.18.6
  conda-build version : 1.14.1
       python version : 2.7.10.final.0
     requests version : 2.8.1
     root environment : /Users/Carol/anaconda  (writable)
  default environment : /Users/Carol/anaconda
     envs directories : /Users/Carol/anaconda/envs
        package cache : /Users/Carol/anaconda/pkgs
         channel URLs : https://repo.continuum.io/pkgs/free/osx-64/
                        https://repo.continuum.io/pkgs/free/noarch/
                        https://repo.continuum.io/pkgs/pro/osx-64/
                        https://repo.continuum.io/pkgs/pro/noarch/
          config file : None
    is foreign system : False

有任何想法吗?

我正在使用 Mac Pro(2013 年末)OS X El capitan 10.11.1

Python 2.7.10 |Anaconda 2.4.0 (x86_64)| (default, Oct 19 2015, 18:31:17) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.

答案1

我觉得这似乎是 DNS 问题。你可以浏览互联网但速度较慢,这可能是因为你实际上并没有打开这些页面,而是从本地磁盘获取缓存副本。

此外,的返回代码为curl6似乎证实了 DNS 问题:

6      Couldn't resolve host. The given remote host was not resolved.

编辑您的/etc/resolv.conf文件并将以下两行放入其中:

nameserver 8.8.8.8
nameserver 8.8.4.4

这些 IP 是 Google 的 DNS 服务器,应该可以在大多数机器上使用。然后,DNS 解析应该可以正常工作。

相关内容