有台机器好久未登录了,今天执行pip的时候报错如下:AttributeError: ‘module’ object has no attribute ‘SSL_ST_INIT’,鼓捣了半天终于搞定。
环境: python2.7
网上搜索了下,应该是pyOpenSSL模块的问题,因为pip执行报错,需要先删除这个模块,重新安装即可,具体操作如下:
sudo rm -rf /usr/lib/python2.7/dist-packages/OpenSSL/ sudo rm -rf /usr/lib/python2.7/dist-packages/pyOpenSSL-0.15.1.egg-info
pip重新安装pyopenssl时又报错
sudo pip install pyopenssl Traceback (most recent call last): File "/usr/bin/pip", line 11, in <module> sys.exit(main()) File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 215, in main locale.setlocale(locale.LC_ALL, '') File "/usr/lib/python2.7/locale.py", line 581, in setlocale return _setlocale(category, locale)
解决办法:
export LC_ALL="en_US.UTF-8" export LC_CTYPE="en_US.UTF-8" sudo dpkg-reconfigure locales
再次安装pyopenssl,这次成功了。
sudo pip install pyopenssl