python - python openssl:如何在搅拌机中安装插件时升级 openssl 版本
问题描述
我有这个插件,我想安装,但不知何故,安装总是由于错误而中断:
urllib.error.URLError: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:720)>
所以我认为问题可能是SSL版本太旧,所以我将版本信息打印出来:
OpenSSL 0.9.8zh 14 Jan 2016
在看到一些答案后,在此处输入链接描述,在此处输入链接描述,在此处输入链接描述现在我的 Mac 上有最新的 SSL,但似乎这个插件使用了一些未安装在我的磁盘上的外部 python,并且这个 python 总是尝试使用它自己的 SSL。我找到了blender使用的这个python,Show Package Contents -> Burrow down to Contents -> Resources -> 2.79 -> python,好像是python 3.5,我在磁盘上安装了python 3.7。
下面是插件的安装代码:
import bpy
import os
import addon_utils
from subprocess import call
from urllib.request import urlretrieve
from zipfile import ZipFile
from tempfile import TemporaryDirectory
from shutil import copytree,rmtree
from os.path import join
python_exec = bpy.app.binary_path_python
path_to_addons = bpy.utils.user_resource('SCRIPTS', "addons")
print('Install Pip')
try:
import pip
except:
rc = call([python_exec,"-m","ensurepip","--default-pip", "--upgrade"])
import pip
print('Download RD')
import ssl
print(ssl.OPENSSL_VERSION)
URL = "https://github.com/HBPNeurorobotics/BlenderRobotDesigner/archive/master.zip"
addon_dir = 'robot_designer_plugin'
zip_dir = "BlenderRobotDesigner-master"
print('Unzip RD')
with TemporaryDirectory() as tmp:
zip_file = join(tmp,"master.zip")
print(zip_file)
urlretrieve(URL,zip_file)
print('Downloaded!')
rc = call([python_exec,"-m","zipfile","-e",zip_file,tmp])
with ZipFile(zip_file, "r") as z:
z.extractall(tmp)
print('Unzip finished')
addon_dir_src = join(tmp,zip_dir,addon_dir)
addon_dir_dst = join(path_to_addons,addon_dir)
print('remove previous addon')
rmtree(addon_dir_dst,True)
print('add latest addon')
copytree(addon_dir_src,addon_dir_dst)
print('enable addon')
addon_utils.enable("robot_designer_plugin", persistent=True)
bpy.ops.wm.save_userpref()
with open(join(addon_dir_src,"requirements.txt")) as f:
for line in f:
rc = call([python_exec,"-m","pip","install",line])
#pip.main(['install', line])
print('RD Installation Done!')
这是终端中引发的错误:
Install Pip
Download RD
OpenSSL 0.9.8zh 14 Jan 2016
Unzip RD
/var/folders/nm/9nfcg98x4hxf1kh08dj8p92h0000gn/T/tmpvd4k0lfi/master.zip
Traceback (most recent call last):
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 1254, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py", line 1107, in request
self._send_request(method, url, body, headers)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py", line 1152, in _send_request
self.endheaders(body)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py", line 1103, in endheaders
self._send_output(message_body)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py", line 934, in _send_output
self.send(msg)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py", line 877, in send
self.connect()
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py", line 1261, in connect
server_hostname=server_hostname)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/ssl.py", line 385, in wrap_socket
_context=self)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/ssl.py", line 760, in __init__
self.do_handshake()
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/ssl.py", line 996, in do_handshake
self._sslobj.do_handshake()
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/ssl.py", line 641, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:720)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/gaoyingqiang/Downloads/installer.blend/Text", line 40, in <module>
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 188, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 466, in open
response = self._open(req, data)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 484, in _open
'_open', req)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 444, in _call_chain
result = func(*args)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 1297, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py", line 1256, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:720)>
Error: Python script fail, look in the console for now...
我真的不知道哪里出了问题,因为插件没有提供关于这个问题的进一步信息。我怎样才能解决这个问题?
新版本:
我现在想解决如何在 Blender 中的 python 中升级 openssl 版本的问题。Blender 带来了 python3.5,我怎么能brew install openssl
到这个 python 而不是我磁盘上的 python?
解决方案
推荐阅读
- php - 为什么 PHPUnit 不标记 order-by 和 stop-on 工作(我期望它们的方式)?
- javascript - 使用 UploadBrowserDataToBlockBlob 从 Javascript 上传时在 Azure Blob 上设置 ContentType
- nsis - 未引用安装功能“” - 归零代码
- asp.net - GridView 不在 UpdatePanel 内呈现
- http - 空手道 - 根据先前的请求发布响应
- jsf - 使用primefaces显示存储在项目外部的图像
- obiee - 我想使用 rtf 模板在 BI Publisher Report 中添加条形码,可以吗?
- c++ - 如何将 xt::sum 表达式结果转换为整数
- sql - 用于在 SQL 数据库属性更改时获取警报的 Powershell 脚本
- javascript - 打字稿:扩展div元素的属性在react ref上失败