首页 > 解决方案 > PIP 安装失败

问题描述

尝试安装evdev 等效项失败:

Users-MacBook-Air:~ user$ sudo pip install hidapi
The directory '/Users/user/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/user/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting hidapi
  Could not fetch URL https://pypi.python.org/simple/hidapi/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
  Could not find a version that satisfies the requirement hidapi (from versions: )
No matching distribution found for hidapi

第二次尝试使用 -H 标志

Users-MacBook-Air:~ user$ sudo -H pip install hidapi
Could not fetch URL https://pypi.python.org/simple/hidapi/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
  Could not find a version that satisfies the requirement hidapi (from versions: )
No matching distribution found for hidapi

TLSV1 错误是因为解释器不支持 TLS v1.2,你必须升级你的解释器。 要诊断您的 TLS 版本:

python -c "import json, urllib2; print json.load(urllib2.urlopen('https://www.howsmyssl.com/a/check'))['tls_version']"

我的 TLS 版本返回 1.0。

问题

  1. 以上信息是否足以定义安装失败?
  2. 必须执行哪些测试来诊断纠正措施?
  3. 如果有足够的信息,正确的纠正措施是什么?
  4. “解释器”到底是什么(Python 的一部分?pip 的一部分?),它是如何升级的?

标签: piposx-mavericks

解决方案


  1. 是的。安装失败只是意味着它没有安装,所以一个真正的测试是尝试导入模块并且它失败了。

  2. 只要您可以看到大部分或全部错误日志,简单的安装应该是一个很好的测试。

  3. 似乎您无权访问计算机的 Pip 目录,这可以通过添加--user标志来解决。而且 Pip 也找不到您请求的模块的名称。要么是因为它不在 PyPi 上,要么是因为 Internet/https 问题确保它在 PyPi 上或从.whl文件安装,大多数模块都可以通过谷歌搜索找到该文件。


推荐阅读