我试图在Mac OS X 10.7.5上下载NLTK 3.0以用于Python 3.6,但是我收到了SSL错误:
import nltk
nltk.download()
Run Code Online (Sandbox Code Playgroud)
我用pip3命令下载了NLTK : sudo pip3 install -U nltk.
更改NLTK下载程序中的索引允许下载程序显示所有NLTK文件,但是当尝试下载所有文件时,会发生另一个SSL错误(请参阅照片底部):
我对计算机科学比较陌生,对SSL一点也不陌生.
我的问题是如何简单地解决这个问题?
以下是遇到相同问题的用户的类似问题:
我决定发布一个带截图的新问题,因为我对其他问题的编辑被拒绝了.
类似的问题,我没有找到帮助:
尝试为nltk安装Punkt时出现以下错误:
nltk.download('punkt')
[nltk_data] Error loading Punkt: <urlopen error [SSL:
[nltk_data] CERTIFICATE_VERIFY_FAILED] certificate verify failed
[nltk_data] (_ssl.c:590)>
False
Run Code Online (Sandbox Code Playgroud) Pip总是失败,即使我做pip install dedupe或pip install --trusted-host pypi.python.org dedupe
无论如何,输出总是相同的:
收集重复数据删除
重试(重试(总计= 4,连接=无,读取=无,重定向=无,状态=无))连接被"SSLError"破坏后(SSLError(1,'[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c: 777)'),)':/ simple/dedupe/
Retrying ...跳绳
找不到满足需求重复数据删除的版本(来自版本:)没有找到重复数据删除的匹配分布
所以我卸载了anaconda并重新安装了它.一样.
你认为问题是我的_ssl.c文件(我不知道它在哪里)必须是腐败的还是什么?为什么pip需要引用,如果我告诉它绕过ssl验证呢?
这是我在 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) 我通过Anaconda在Python 3.5.2上运行OS X El Capitan并且拥有spaCy 0.101.0.
我正在尝试使用安装spaCy英语语言模型python -m spacy.en.download.但是,当我这样做时,我得到一个错误urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)>.完整的Traceback如下:
Traceback (most recent call last):
File "/Users/bsherman/anaconda/lib/python3.5/urllib/request.py", line 1254, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 1106, in request
self._send_request(method, url, body, headers)
File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 1151, in _send_request
self.endheaders(body)
File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 1102, in endheaders
self._send_output(message_body)
File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 934, in _send_output
self.send(msg)
File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 877, in send
self.connect()
File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 1260, in connect …Run Code Online (Sandbox Code Playgroud) 我的Python安全websocket客户端代码给我例外如下:
[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c:748)
我已经创建了我的私有证书和签名证书,但我无法使用Python脚本连接到它,如下所示:
import json
from websocket import create_connection
class subscriber:
def listenForever(self):
try:
# ws = create_connection("wss://localhost:9080/websocket")
ws = create_connection("wss://nbtstaging.westeurope.cloudapp.azure.com:9090/websocket")
ws.send("test message")
while True:
result = ws.recv()
result = json.loads(result)
print("Received '%s'" % result)
ws.close()
except Exception as ex:
print("exception: ", format(ex))
try:
subscriber().listenForever()
except:
print("Exception occured: ")
Run Code Online (Sandbox Code Playgroud)
我在python中使用龙卷风的https/wss服务器脚本如下:
import tornado.web
import tornado.websocket
import tornado.httpserver
import tornado.ioloop
import os
import ssl
ssl_root = os.path.join(os.path.dirname(__file__), 'ssl1_1020')
class WebSocketHandler(tornado.websocket.WebSocketHandler):
def check_origin(self, origin):
return True
def open(self):
pass
def on_message(self, message):
self.write_message("Your …Run Code Online (Sandbox Code Playgroud)