pip无法正常使用

发布于 2022-09-06 00:12:54 字数 4829 浏览 10 评论 0

win10系统,pip list可以正常显示,安装下载好的*whl可以正常安装
但是pip联网安装包的时候会报错,例如

pip install colorama

就会报错

C:\Users\bruce0>pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
numpy (1.13.3+mkl)
pip (9.0.1)
scipy (0.19.1)
setuptools (28.8.0)

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

路径里面没有中文,pip更新命令也无法执行

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文