在mac上安装python时,我无法获得tls v1.2支持。
这是我的openssl版本:
openssl version
OpenSSL 1.0.2h 3 May 2016
下面是我的python版本:
python --version
Python 2.7.11
我就是这样测试的:
>>> import ssl
>>> ssl.PROTOCOL_TLSv1_2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'PROTOCOL_TLSv1_2'
正在阅读:https://docs.python.org/2/library/ssl.html 上面写着:
Some behavior may be platform dependent, since calls are made to the operating system socket APIs. The installed version of OpenSSL may also cause variations in behavior. For example, TLSv1.1 and TLSv1.2 come with openssl version 1.0.1.
因此,我在安装OpenSSL 1.0.2h时需要tlsv1.2支持
有人有什么想法吗?
问题是python使用的openssl版本不支持TLS 1.2。
我在brew中安装了openssl,然后重新安装了python,告诉它使用与brew一起安装的openssl:
然后一切都成功了!
相关问题 更多 >
编程相关推荐