简体   繁体   English

无法使用pip安装

[英]Cannot install using pip

I'm trying to install matplotlib for python 3.6.3 using, but I keep getting this exception all the time. 我正在尝试使用python 3.6.3安装matplotlib,但是我一直都在获取此异常。 I have tried using the whl files too, to do it manually, but same result. 我也尝试过使用whl文件来手动进行操作,但是结果相同。 I'm using this link to get the whl: 我正在使用此链接来获得:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#setuptools https://www.lfd.uci.edu/~gohlke/pythonlibs/#setuptools

Also tried Anaconda, and python 2.7,3.4 and 3.5, and still can't fix the issue. 还尝试了Anaconda以及python 2.7、3.4和3.5,但仍然无法解决该问题。

Exception:
Traceback (most recent call last):
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\commands\install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_set.py", line 554, in _prepare_file
    require_hashes
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\index.py", line 792, in get_page
    "Cache-Control": "max-age=600",
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\requests\sessions.py", line 488, in get
    return self.request('GET', url, **kwargs)
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\requests\sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\requests\sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\requests\adapters.py", line 423, in send
    timeout=timeout
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 589, in urlopen
    self._prepare_proxy(conn)
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 797, in _prepare_proxy
    conn.connect()
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 254, in connect
    conn = self._new_conn()
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 142, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\connection.py", line 66, in create_connection
    if host.startswith('['):
AttributeError: 'NoneType' object has no attribute 'startswith'

Try upgrading pip 尝试升级点

pip install --upgrade pip

You might have to use the full path to pip, if it's not in the PATH variable, like so: 如果不在PATH变量中,则可能必须使用完整路径来pip,如下所示:

C:\Users\Marcin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip install --upgrade pip

Edit: After searching and finding some duplicates on the web (with no solutions), it seems to me it might have something to do with the path of your python installation. 编辑:在网上搜索并找到一些重复项(没有解决方案)后,在我看来,这可能与python安装路径有关。 Such as: duplicate 1 , and duplicate 2 . 如: 重复1重复2

Is there a reason its not installed on the default C:\\Python36-32 folder? 是否有原因未将其安装在默认的C:\\ Python36-32文件夹中? You might want to download and install the windows msi installer for python in the recommended way, and see where that gets you. 您可能想以推荐的方式下载并安装适用于python的Windows msi安装程序,然后查看可以从何处获得帮助。

Solution: 解:

After OP's comment, it seems that moving Python to C:\\ path (preferably with a clean install with windows .msi from python.org should fix this issue. 在OP发表评论后,似乎将Python移至C:\\路径(最好使用python.org的 windows .msi进行全新安装可以解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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