Python AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

后端 未结 20 1651
無奈伤痛
無奈伤痛 2020-11-29 02:06

A Python script of mine is failing with:

Traceback (most recent call last):
  File \"./inspect_sheet.py\", line 21, in 
    main()
  File \"./i         


        
20条回答
  •  生来不讨喜
    2020-11-29 02:35

    I had a similar error:

        from OpenSSL import rand, crypto, SSL
      File "/usr/local/lib/python3.5/dist-packages/OpenSSL/SSL.py", line 112, in 
        SSL_ST_INIT = _lib.SSL_ST_INIT
    AttributeError: module 'lib' has no attribute 'SSL_ST_INIT'
    

    and none of the other answers could fix it, because pip could not install anything. Instead, what I did was this from the terminal first:

    sudo rm -r /usr/local/lib/python3.5/dist-packages/OpenSSL
    

    Then reinstalled pyopenssl with pip:

    sudo pip install pyopenssl
    

    and everything was gravy.

提交回复
热议问题