mbu*_*s02 14 python ssl openssl nas dropbox-api
我有一个旧的鼻盒上的Dropbox上传脚本,最近我收到了以下错误
SSL证书错误:[Errno 1] _ssl.c:504:错误:0D0890A1:asn1编码例程:ASN1_verify:未知消息摘要算法
我认为这是因为openssl已经过时了
所以我下载openssl,从源代码构建并安装它,现在当我运行以下内容时,它似乎正确更新.
openssl version
OpenSSL 1.0.1h 5 Jun 2014
Run Code Online (Sandbox Code Playgroud)
但是看起来Python仍然引用旧版本,我该如何更新?
python -c "import ssl; print ssl.OPENSSL_VERSION"
OpenSSL 0.9.7m 23 Feb 2007
Run Code Online (Sandbox Code Playgroud)
Aru*_*san 20
几天后这个工作了.MAC OS X El Captian或更高版本
sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7
sudo rm -rf "/Applications/Python 2.7"
cd /usr/local/bin/
ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7' | awk '{print $9}' | tr -d @ | xargs rm
brew uninstall python
brew uninstall openssl
brew link --force openssl
Run Code Online (Sandbox Code Playgroud)
现在使用brew再次安装python和openssl.
brew install openssl
brew install python --with-brewed-openssl
Run Code Online (Sandbox Code Playgroud)
将以下内容添加到MAC上〜/ .bash_profile中的PATH中
vi ~/.bash_profile
export PATH=/usr/local/opt/openssl/bin:/usr/local/opt/python/libexec/bin:$PATH
Run Code Online (Sandbox Code Playgroud)
重启终端
python --version (verify if it is picking up the right version)
openssl version -a (verify if it is picking up the right version)
python -c "import ssl; print ssl.OPENSSL_VERSION"
Run Code Online (Sandbox Code Playgroud)
(注意:如果安装了Python3,则必须更新print内联编译器步骤中的语法)
python -c "import ssl; print(ssl.OPENSSL_VERSION)"
Run Code Online (Sandbox Code Playgroud)
应该为您提供最新版本的OPEN SSL版本
2018年在MacOS上
我尝试了其他答案但没有成功:
--with-brewed-openssl选项提供Warning: python: this formula has no --with-brewed-openssl option so it will be ignored! brew link openssl --force给出Warning: Refusing to link: openssl我得到了它
brew install openssl
brew install python@2
Run Code Online (Sandbox Code Playgroud)
然后
openssl version
Run Code Online (Sandbox Code Playgroud)
和
python -c "import ssl; print ssl.OPENSSL_VERSION"
Run Code Online (Sandbox Code Playgroud)
给了我相同的OpenSSL版本.
小智 5
请参阅http://rkulla.blogspot.kr/2014/03/the-path-to-homebrew.html.
我得到了和你一样的问题,所以我搜索了几个答案,但这对我没有帮助.
在homebrew上将openssl升级到1.0.1j之后,但是系统python仍然提到旧版本0.9.8.原来,这个python被称为openssl.所以我用brewed openssl安装了新的python并在Mac上完成了这个问题,还没有Ubuntu.
在Mac OS X版本10.10和系统python版本2.7.6上,我的过程如下.
$ brew update $ brew install openssl. 然后你可以看到openssl版本1.0.1j. $ brew link openssl --force $ brew install python --with-brewed-openssl. 你必须使用brewed openssl安装新的python.然后,您可以看到/usr/local/Cellar/python/2.7.8_2/bin/python.$ sudo ln -s /usr/local/Cellar/python/2.7.8_2/bin/python /usr/local/bin/python. 当然,/ usr/local/*应该由$ USER拥有,而不是root,Ryan告诉我,但是我使用了'sudo'.并且,在此指令之前,我没有/ usr/local/bin/python.在这条指令之后,你可以使用python版本2.7.8而不是2.7.6.最后,你可以看到如下;
$ python --version
Run Code Online (Sandbox Code Playgroud)
Python 2.7.8
$ python -c "import ssl; print ssl.OPENSSL_VERSION"
Run Code Online (Sandbox Code Playgroud)
OpenSSL 1.0.1j 2014年10月15日
直到现在,我正在Ubuntu 12.04上进行研究.如果我有Ubuntu 12.04的解决方案,那么我将更新我的答案.我希望这个程序可以帮到你.
| 归档时间: |
|
| 查看次数: |
25502 次 |
| 最近记录: |