首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法获取URL

无法获取URL
EN

Stack Overflow用户
提问于 2017-12-06 04:56:41
回答 1查看 1.2K关注 0票数 0

,这不是重复的,,我看过网上的所有回复。

每当我试图通过终端连接到一个网站时,我都会发现一个错误。很多解决方案都说先安装证书,然后再尝试,但我也做不到,因为那时我必须连接到https://pypi.python.org/simple/certifi/。我也尝试过--trusted-host,但仍然收到一个错误。

如果我试图在Python3.6文件夹中运行安装Certificates.command,则会出现以下错误:

代码语言:javascript
复制
/Applications/Python\ 3.6/Install\ Certificates.command ; exit;
 -- pip install --upgrade certifi
Collecting certifi
  Could not fetch URL https://pypi.python.org/simple/certifi/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777) - skipping
  Could not find a version that satisfies the requirement certifi (from versions: )
No matching distribution found for certifi
Traceback (most recent call last):
  File "<stdin>", line 44, in <module>
  File "<stdin>", line 25, in main
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6', '-E', '-s', '-m', 'pip', 'install', '--upgrade', 'certifi']' returned non-zero exit status 1.
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

如果我尝试使用url连接python,然后尝试在终端中运行python,我也会得到SSL错误。让我也提一提,这是一个全新的问题。我昨天运行了同样的脚本,效果很好。

版本:

代码语言:javascript
复制
Python 3.6
numpy==1.13.3
ortools==6.6.4656
pandas==0.21.0
protobuf==3.5.0.post1
python-dateutil==2.6.1
pytz==2017.3
six==1.11.0
OpenSSH_7.4p1, LibreSSL 2.5.0
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-12-06 05:09:31

在脚本中添加以下行并执行脚本。也许它能解决你的问题。

代码语言:javascript
复制
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47667044

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档