尝试安装程序时,ssl证书验证在python上失败

时间:2018-05-04 12:21:34

标签: python ssl-certificate failed-installation

我几乎没有编码经验,我正在尝试在我的mac(osX Yosemite)上安装一些软件。该软件采用FSL软件包,可实现神经解剖学的可视化。有关安装说明,请访问https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation/MacOsX 每当我尝试安装它时,我都会得到代码

olegs-MacBook-Air-4:Downloads Sonya$ cd ~/Downloads
olegs-MacBook-Air-4:Downloads Sonya$ python fslinstaller.py
--- FSL Installer - Version 3.0.11 ---
[Warning] Some operations of the installer require administative rights,
    for example installing into the default folder of /usr/local.
    If your account is an 'Administrator' (you have 'sudo' rights)
    then you will be prompted for your administrator password
    when necessary.
When asked a question, the default answer is given in square brackets.
Hit the Enter key to accept this default answer.

[FAILED] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)
olegs-MacBook-Air-4:Downloads Sonya$

真的不知道该怎么办,任何帮助都会受到赞赏

更新 我刚刚尝试了同样的命令,现在已经获得了代码

olegs-MacBook-Air-4:~ Sonya$ cd ~/Downloads
olegs-MacBook-Air-4:Downloads Sonya$ python fslinstaller.py
--- FSL Installer - Version 3.0.11 ---
[Warning] Some operations of the installer require administative rights,
    for example installing into the default folder of /usr/local.
    If your account is an 'Administrator' (you have 'sudo' rights)
    then you will be prompted for your administrator password
    when necessary.
When asked a question, the default answer is given in square brackets.
Hit the Enter key to accept this default answer.


[FAILED] nodename nor servname provided, or not known

2 个答案:

答案 0 :(得分:1)

不确定您是否仍然遇到麻烦,但我认为您的问题可能与this one相同

解决方案是将python fslinstaller.py更改为/usr/bin/python fslinstaller.py

如果这不起作用,则可能是python的完整路径错误。您可以使用which pythonwhich python2which python2.7找到合适的一个。其中之一可能会起作用

在我的情况下,我需要运行命令sudo /usr/bin/python2.7 fslinstaller.py,安装程序才能正常工作

答案 1 :(得分:0)

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

将此代码放在 fslinstaller.py 的顶部并运行 python fslinstaller.py。 就我而言,它奏效了。