Python “pip install ” is failing with AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

后端 未结 4 1204
心在旅途
心在旅途 2020-12-12 16:33

$ sudo pip install --upgrade pyOpenSSL

Traceback (most recent call last):
  File \"/usr/local/bin/pip\", line 9, in 
load_entry_point(\'pip==8.         


        
相关标签:
4条回答
  • 2020-12-12 16:34

    Upgrading pyOpenSSL to 16.2.0 fixes it.

    pip uninstall pyOpenSSL
    pip install pyOpenSSL==16.2.0
    

    There is an issue with version compatibility.

    0 讨论(0)
  • 2020-12-12 16:41

    Below method worked for me, I am using Ubuntu 20.04 and wanted to install Objection for Runtime manipulation and dynamic analysis of iOS apps.

    Short Background:

    I noticed that when I fired pip3 install objection in terminal it gave me same error as you but the directory path was little bit different. In my case it was related to python3.8, so I did following things

    Solution:

    rm -rf /home/smshrimant/.local/lib/python3.8/site-packages/OpenSSL/
    
    sudo rm -rf /usr/local/lib/python3.8/dist-packages/OpenSSL/
    
    0 讨论(0)
  • 2020-12-12 16:46

    I did the following which seemed to fix the error, not sure if it's the correct way, but it did fix the error on my machine:

    I first backed up the directories below, recommend you do same.

    rm -rf /usr/lib/python2.7/dist-packages/OpenSSL
    rm -rf /usr/lib/python2.7/dist-packages/pyOpenSSL-0.15.1.egg-info
    sudo pip install pyopenssl
    

    I couldn't uninstall it because every time I ran pip I got the same error you did: 'module' object has no attribute 'SSL_ST_INIT'.

    After the above my pip now works and more importantly my ansible now works (which was broken by my previous updates).

    Not sure if it will work on your system, and removing things out of band, like I did, is risky at best, so as a warning, I would say, your mileage may vary with my kludgy fix, use caution!

    0 讨论(0)
  • 2020-12-12 16:55

    I ran into this issue as well. The solution proposed to run pip doesn't work because pip is broken too! I found this solved it for me:

    sudo python -m easy_install --upgrade pyOpenSSL
    

    This installed version 17.3.0 which was an upgrade to the (stock python-openssl on xenial) version ?0.15.1?. Note the massive change in version it could be they dropped the leading 0. in later versions.

    Anyway, after that, pip and ansible started to work again.

    0 讨论(0)
提交回复
热议问题