【问题标题】:ssl certificate verify failed on python when trying to install a programme尝试安装程序时,python 上的 ssl 证书验证失败
【发布时间】:2018-05-04 12:21:34
【问题描述】:

我几乎没有编码经验,正在尝试在我的 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

【问题讨论】:

  • 您是否尝试过使用:sudo python fslinstaller.py? (假设您有管理员权限)
  • 嗨,刚刚尝试并得到了这个 olegs-MacBook-Air-4:~ Sonya$ sudo python fslinstaller.py 密码:/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python。 app/Contents/MacOS/Python:无法打开文件“fslinstaller.py”:[Errno 2] 没有这样的文件或目录

标签: python ssl-certificate failed-installation


【解决方案1】:

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

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

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

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

【讨论】:

    【解决方案2】:
    import ssl
    ssl._create_default_https_context = ssl._create_unverified_context
    

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

    【讨论】:

    • 这会禁用 HTTPS 验证,这意味着它会使您容易受到中间人攻击
    猜你喜欢
    • 1970-01-01
    • 2015-06-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-06
    • 2017-11-22
    • 2017-07-19
    相关资源
    最近更新 更多