python openssl:如何在blender中安装插件时升级openssl版本

python openssl:如何在blender中安装插件时升级openssl版本,python,ssl,openssl,blender,Python,Ssl,Openssl,Blender,我有这个插件,我想安装,但不知怎的,安装总是因为错误而中断: urllib.error.urleror: 所以我认为问题可能是SSL版本太旧了,所以我打印了版本信息: OpenSSL 0.9.8zh 14 Jan 2016 在看到一些答案之后,现在我在我的mac上有了最新的SSL,但是这个插件似乎使用了一些外部python,而这些python没有安装在我的磁盘上,并且这个python总是尝试使用它自己的SSL。我发现blender使用的python,Show Package Contents-

我有这个插件,我想安装,但不知怎的,安装总是因为错误而中断:

urllib.error.urleror:

所以我认为问题可能是SSL版本太旧了,所以我打印了版本信息:

OpenSSL 0.9.8zh 14 Jan 2016
在看到一些答案之后,现在我在我的mac上有了最新的SSL,但是这个插件似乎使用了一些外部python,而这些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!')
Und这是在终端中引发的错误:

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...
安装Pip
下载RD
OpenSSL 0.9.8zh 2016年1月14日
解压
/var/folders/nm/9nfcg98x4hxf1kh08dj8p92h0000gn/T/tmpvd4k0lfi/master.zip
回溯(最近一次呼叫最后一次):
文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py”,第1254行,在do_open中
h、 请求(请求获取方法(),请求选择器,请求数据,标题)
请求中的文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py”,第1107行
self.\u发送请求(方法、url、正文、标题)
文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py”,第1152行,在发送请求中
self.endheaders(主体)
文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py”,第1103行,在endheaders中
自发送输出(消息体)
文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py”,第934行,在发送输出中
self.send(msg)
文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py”,第877行,在send中
self.connect()
文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/http/client.py”,第1261行,在connect中
服务器\主机名=服务器\主机名)
文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/ssl.py”,第385行,在wrap_套接字中
_上下文=自身)
文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/ssl.py”,第760行,在__
self.do_握手
文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/ssl.py”,第996行,在do_握手中
赛尔夫:握手
文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/ssl.py”,第641行,在do_握手中
赛尔夫:握手
ssl.SSLError:[ssl:TLSV1警报协议版本]TLSV1警报协议版本(\u ssl.c:720)
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“/Users/gaoyngqiang/Downloads/installer.blend/Text”,第40行,在
文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py”,urlretrieve中第188行
使用contextlib.closing(urlopen(url,data))作为fp:
urlopen中的文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py”,第163行
返回opener.open(url、数据、超时)
打开文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py”,第466行
响应=自身打开(请求,数据)
文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py”,第484行,打开
"开放",
文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py”,第444行,在调用链中
结果=func(*args)
https_open中的文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py”,第1297行
上下文=self.\u上下文,检查主机名=self.\u检查主机名)
文件“/Applications/Blender/Blender.app/Contents/Resources/2.79/python/lib/python3.5/urllib/request.py”,第1256行,在do_open中
引发URL错误(err)
urllib.error.urleror:
错误:Python脚本失败,现在请查看控制台。。。
我真的不知道哪里出了问题,因为插件没有提供关于这个问题的进一步信息。我怎样才能解决这个问题

新版:


现在我想解决如何在搅拌机中的python中升级openssl版本的问题。Blender附带了python3.5,我怎样才能
brew将openssl安装到此python而不是磁盘上的python?

您可能已经安装了python 3.7,但Blender是内置的,并且正在使用python3.5,这是Blender安装的一部分。首先查看是否已使用更新的openssl系统库构建。您还可以尝试获得最近的Python3.5.x版本,并用blender替换该版本。如果这失败了,那将是一个问题。