python3 で requests ( _ssl )が import できなくなった場合 (mac)

Python
2015-06-17 20:08 (9年前) ytyng
View in English
Traceback (most recent call last):
  File "/Applications/Develop/PyCharm.app/helpers/pycharm/django_test_manage.py", line 51, in <module>
    django.setup()
  ...
  File "/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  ...
  File "/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ssl.py", line 97, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: dlopen(/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload/_ssl.so, 2): Symbol not found: _SSLv2_method
  Referenced from: /usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload/_ssl.so
  Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
 in /usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload/_ssl.so

こんなエラーが出るようになった。

brew で python を入れなおし、virtualenv を作りなおしたら直った

$ brew unlink python3
$ brew install python3

$ rm -r .virtualenvs/myvirtualenv

$ pyvenv-3.4 .virtualenvs/myvirtualenv
$ workon myvirtualenv
$ pip install --upgrade pip
$ pip install -r requirements.txt
...

※ brew install python したら、vim を起動する時に

    import io as _io
  File "/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in <module>
    import _io
ImportError: dlopen(/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyErr_ReplaceException

こんなのが出たので、brew uninstall python で削除した。

現在未評価
タイトルとURLをコピー

コメント

アーカイブ

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011