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

后端 未结 20 1656
無奈伤痛
無奈伤痛 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:38

    I had this problem on MacOS with python 2 and 3 installed via brew. It turns out that brew uninstalling python and python@2 does not remove any libraries which were installed for those versions of python; i.e. in:

    /usr/local/lib/python3.7/site-packages/ and
    /usr/local/lib/python2.7/site-packages/

    Something in there was not right, so what worked for me was to delete/move all the installed libraries for brew's python 2 and 3 and start again (and make sure only to use virtualenvs from here on):

    brew uninstall --ignore-dependencies python@2
    brew uninstall --ignore-dependencies python
    sudo mv /usr/local/lib/python3.7 ~/python3.7libs-backup
    sudo mv /usr/local/lib/python2.7 ~/python2.7libs-backup
    brew install python
    brew install python@2
    

提交回复
热议问题