代码之家  ›  专栏  ›  技术社区  ›  Fallenreaper

pip install gitpython,pip search返回堆栈跟踪。我认为PIP需要更新,但是会出现SSL错误

  •  0
  • Fallenreaper  · 技术社区  · 6 年前

    似乎搜索导致了一个SSL错误,当试图进行安装时,它找不到正确的包。当我进行搜索时,它给出了一个SSL问题

    File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/_vendor/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
    File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/_vendor/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
    SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)
    

    最后,如果我试图升级pip以解决问题,它也有一个ssl问题:

    Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
    

    编辑 由于我的Mac,这看起来像是一个过时的与openssl相关的SSL问题。也就是说,它可能是 ssl.SSLError: tlsv1 alert protocol version 但我正试图遵循它来解决问题。

    1 回复  |  直到 6 年前
        1
  •  0
  •   Fallenreaper    6 年前

    这是一个双管齐下的答案。

    1:更新openssl。

    brew update
    brew install openssl
    

    2:要得到gitpython,pip仍然会失败。问题是,尽管gitpython为2.7工作,但出于某种原因,它不喜欢它。我确认了 pyton3.6 -m pip install gitpython 有效,但在PIP中使用2.7时,

    pip --version
    pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
    pip install gitpython
        Exception:
    Traceback (most recent call last):
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
        status = self.run(options, args)
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
        prefix=options.prefix_path,
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
        **kwargs
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
        self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
        isolated=self.isolated,
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files
        clobber(source, lib_dir, True)
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 316, in clobber
        ensure_dir(destdir)
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 83, in ensure_dir
        os.makedirs(path)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
        mkdir(name, mode)
    OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/smmap'
    You are using pip version 9.0.1, however version 18.0 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    

    当试图升级pip时,我没有权限,同样,当我sudo pip时,它也不喜欢它。

    最终,由于我是一个3.6人,这解决了我的问题,但我想给那些使用2.7的人一些启示。