相关疑难解决方法(0)

urllib和"SSL:CERTIFICATE_VERIFY_FAILED"错误

我收到以下错误:

Exception in thread Thread-3:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in        __bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in  run
self.__target(*self.__args, **self.__kwargs)
File "/Users/Matthew/Desktop/Skypebot 2.0/bot.py", line 271, in process
info = urllib2.urlopen(req).read()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open
context=self._context)
File …
Run Code Online (Sandbox Code Playgroud)

python ssl urllib ssl-certificate python-2.7

250
推荐指数
19
解决办法
55万
查看次数

pip连接失败:无法获取索引基URL http://pypi.python.org/simple/

我跑sudo pip install git-review,并得到以下消息:

Downloading/unpacking git-review
  Cannot fetch index base URL http://pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement git-review
No distributions at all found for git-review
Storing complete log in /home/sai/.pip/pip.log
Run Code Online (Sandbox Code Playgroud)

有没有人对此有任何想法?

python git ubuntu pip git-review

76
推荐指数
8
解决办法
21万
查看次数

刮刮:SSL:http://en.wikipedia.org的CERTIFICATE_VERIFY_FAILED错误

我正在练习'Web Scraping with Python'的代码,我一直有这个证书问题:

from urllib.request import urlopen 
from bs4 import BeautifulSoup 
import re

pages = set()
def getLinks(pageUrl):
    global pages
    html = urlopen("http://en.wikipedia.org"+pageUrl)
    bsObj = BeautifulSoup(html)
    for link in bsObj.findAll("a", href=re.compile("^(/wiki/)")):
        if 'href' in link.attrs:
            if link.attrs['href'] not in pages:
                #We have encountered a new page
                newPage = link.attrs['href'] 
                print(newPage) 
                pages.add(newPage) 
                getLinks(newPage)
getLinks("")
Run Code Online (Sandbox Code Playgroud)

错误是:

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1319, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1049)>
Run Code Online (Sandbox Code Playgroud)

顺便说一句,我也在练习scrapy,但一直都在解决问题:找不到命令:scrapy(我在网上尝试过各种解决方案,但都没有用......真的很令人沮丧)

python beautifulsoup ssl-certificate scrapy web-scraping

37
推荐指数
13
解决办法
4万
查看次数

urllib.error.URLError: &lt;urlopen 错误 [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1108)

import yfinance as yf
Run Code Online (Sandbox Code Playgroud)

msft = yf.Ticker("MSFT")

微软信息网

我尝试打印 msft.info 并收到“urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1108)”错误。我尝试重新运行 Install Certificates.command 和 Update Sheet.command 但显然它不起作用。另外,在我重新运行它们之后,我得到了这个消息: 由于环境错误无法安装软件包:[Errno 13]权限被拒绝:'/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ certifi-2021.5.30.dist-info。

有什么建议我该如何修复它吗?

python macos python-3.8

31
推荐指数
2
解决办法
8万
查看次数

Brew 3.6.1的Brew安装:[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败

我安装了python 3.6

brew install python3

并尝试six.moves.urllib.request.urlretrieve从https 下载文件,但它会引发错误

ssl.SSLError:[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c:749)

在Python安装(从.pkg)的,自述指示一个需要运行Install Certificates.command在安装后

  1. 安装 certifi
  2. 符号链接路径的证书certify路径

能够使用证书.

但是,在brew安装中,此文件不存在,似乎不会运行.

python ssl

15
推荐指数
5
解决办法
1万
查看次数

使用熊猫时出现错误 urlopen 错误 [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败

这是我在 python3 中的代码:

import pandas as pd

tables = pd.read_html("http://http.com/")

print(tables)
Run Code Online (Sandbox Code Playgroud)

我收到了这个错误:

Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect
    server_hostname=server_hostname)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 401, in wrap_socket
    _context=self, _session=session) …
Run Code Online (Sandbox Code Playgroud)

ssl python-3.x pandas

12
推荐指数
2
解决办法
7573
查看次数

SSL: CERTIFICATE_VERIFY_FAILED 错误与 macOS 10.15 上的 python3

/usr/bin/python3来自 macOS 10.15 上的 Xcode/CLT(目前为 DB6/PB5,使用 Xcode 11 beta 6)SSL: CERTIFICATE_VERIFY_FAILED对于源自 PSL 的所有 HTTPS 请求失败,例如来自urllib.request

$ /usr/bin/python3 -c 'import urllib.request; urllib.request.urlopen("https://www.apple.com/")'
...
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题呢?

(我知道答案,很快就会发布;只是分享它以防其他人遇到它。)

python macos macos-catalina

10
推荐指数
2
解决办法
5651
查看次数

在pypitest中注册时,SSL:CERTIFICATE_VERIFY_FAILED

我已经按照Peter Down关于将包推送到PyPI的说明http://peterdowns.com/posts/first-time-with-pypi.html

我有一个关于PyPI Live和PyPI测试的帐户,我可以登录并通过电子邮件验证帐户.

但是当我试图在我的回购中运行时:

python setup.py register -r pypitest
Run Code Online (Sandbox Code Playgroud)

我明白了:

running register
running check
Registering [package_name] to https://testpypi.python.org/pypi
Server response (500): <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>
Run Code Online (Sandbox Code Playgroud)

知道出了什么问题吗?我的~/.pypirc文件也是根据我的用户名和密码编写的.

如何解决这个问题,以便我可以在PyPI上注册包?

python ssl software-packaging pypi setup.py

5
推荐指数
0
解决办法
1417
查看次数

使用pyppeteer在requests_html安装chrome时出现python3 SSL证书问题

html.render()requests_html图书馆跑。它正在尝试安装铬,但我收到一个错误

我已经尝试pip install --upgrade certifi过和没有sudo 并得到:Requirement already up-to-date: certifi in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (2019.6.16)

我也尝试运行/Applications/Python\ 3.6/Install\ Certificates command并得到:

 -- pip install --upgrade certifi
Requirement already up-to-date: certifi in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (2019.6.16)
 -- removing any existing file or link
 -- creating symlink to certifi certificate bundle
 -- setting permissions
 -- update complete
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误:

[W:pyppeteer.chromium_downloader] start chromium download.
Download may take a …
Run Code Online (Sandbox Code Playgroud)

python macos python-requests-html

5
推荐指数
2
解决办法
4128
查看次数

在Keras中下载ResNet50会生成“ SSL:CERTIFICATE_VERIFY_FAILED”

我在Tensorflow上使用python 3.6和Keras(2.0.9)

尝试下载经过训练的resnet50模型,但遇到以下错误:异常:https : //github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels.h5上的URL提取失败:无- [SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c:777)

以下是使用的代码:

from keras.applications.resnet50 import ResNet50
from keras.preprocessing import image
from keras.applications.resnet50 import preprocess_input, decode_predictions
import numpy as np

model = ResNet50(weights='imagenet')

img_path = 'elephant.jpg'
img = image.load_img(img_path, target_size=(224, 224))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)
model.summary()
preds = model.predict(x)

print('Predicted:', decode_predictions(preds, top=3)[0])
Run Code Online (Sandbox Code Playgroud)

python keras tensorflow

4
推荐指数
2
解决办法
2117
查看次数

如何在我的 Macbook Air 上通过 Python 3.6 连接到 MongoDB Atlas 而没有 SSL 握手错误?

我已经设置了一个测试 MongoDb Atlas 帐户,只是其中一个免费帐户,并且在我的 Ubuntu 机器上使用以下代码我可以成功创建用户并搜索它们。

当我在 MacBook Air 上尝试完全相同的事情时,我得到了如下所示的 SSL 握手。

pymongo.errors.ServerSelectionTimeoutError: SSL 握手失败: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败 (_ssl.c:833),SSL 握手失败: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败 (_ssl.c:833),SSL 握手失败[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败 (_ssl.c:833)

import pymongo
client = pymongo.MongoClient("mongodb+srv://MYUSERNAME:MYPASSWORD@cluster0-ABCDEF.mongodb.net/test")
db = client.johnny
collection = db.myjohnnytest

example = {'name' : 'Johnny',
            'email' : 'johnny@test.net'}

user_id = collection.insert_one(example).inserted_id
Run Code Online (Sandbox Code Playgroud)

我发现这个答案似乎是关键:

堆栈溢出答案

但是我已经尝试过这个,无论我是完全遵循它还是激活我的 virtualenv,我都会收到以下错误:

找不到激活的 virtualenv(必需)。回溯(最近一次调用):文件“”,第 44 行,文件“”,第 25 行,主文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py” ,第 291 行,在 check_call 中引发 CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6', '-E', '-s' , '-m', 'pip', 'install', '--upgrade', 'certifi']' 返回非零退出状态 3. …

macos ssl mongodb pymongo mongodb-atlas

3
推荐指数
1
解决办法
4335
查看次数

为什么我无法使用 Gensim 下载 API 下载数据集

当我执行以下操作时:

>>> import gensim.downloader as api
>>> model = api.load("glove-twitter-25")  # load glove vectors
Run Code Online (Sandbox Code Playgroud)

gensim.downloader API 抛出以下错误:

[Errno 2] 没有这样的文件或目录:“/Users/vtim/gensim-data/information.json”。

我究竟做错了什么?

python download dataset gensim glove

3
推荐指数
1
解决办法
4743
查看次数