OS/X Sierra 上的 pip 和 maven 的 SSL 证书错误

OS/X Sierra 上的 pip 和 maven 的 SSL 证书错误

SSL 证书问题发生在至少两种不相关类型的进程中:为 构建应用程序python/pip和使用 的scala/java应用程序(sparkmaven

这发生在搭载 Sierra 的全新 Macbook Pro 上。

这是第一个pip::

    $pip install numpy
    Collecting numpy
      Could not fetch URL https://pypi.python.org/simple/numpy/: 
There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661) - skipping
      Could not find a version that satisfies the requirement numpy (from versions: )
    No matching distribution found for numpy

我在其他系统/机器上没有遇到过这个问题。我遵循了这里的建议: https://stackoverflow.com/a/32302448/1056563。但添加--cert path_to_cert没有效果

第二个例子:我做了一个 git cloneSpark试图构建它,如下所示:

$./build/mvn -Pyarn -Phadoop-2.7 -Dhadoop.version=2.7.0 -DskipTests clean package

它立即失败并出现证书错误:

Using `mvn` from path: /usr/local/bin/mvn
[INFO] Scanning for projects...
Downloading: https://repo1.maven.org/maven2/org/apache/apache/14/apache-14.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for org.apache.spark:spark-parent_2.11:2.3.0-SNAPSHOT: Could not transfer artifact org.apache:apache:pom:14 from/to central (https://repo1.maven.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target and 'parent.relativePath' points at wrong local POM @ line 22, column 11
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project org.apache.spark:spark-parent_2.11:2.3.0-SNAPSHOT (/shared/spark/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for org.apache.spark:spark-parent_2.11:2.3.0-SNAPSHOT: Could not transfer artifact org.apache:apache:pom:14 from/to central (https://repo1.maven.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target and 'parent.relativePath' points at wrong local POM @ line 22, column 11 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

我看过明显类似的问题,但没有一个适合我的具体情况:例如 JRE/JDK 中似乎有一个有效的证书:

$ll /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/security/cacerts
-rw-rw-r--  1 root  wheel  113484 Mar 15 01:51 /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/security/cacerts

答案1

卡巴斯基端点安全

通过暂时禁用它 - 在安装 pip / 通过 maven 构建时 - 问题就消失了。

相关内容