conda and pip not working at all

浪尽此生 提交于 2019-12-23 09:37:27

问题


I am on OS X 10.11.2, Anaconda Python 2.7.10.

I was installing some dependencies, and suddenly, my conda command started not working at all. Many people suggest conda install python=2.7.10 but when I try that (or any command, even just conda) I get:

Traceback (most recent call last): File "/Users/Can/anaconda/bin/conda", line 5, in sys.exit(main()) File "/Users/Can/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 106, in main from conda.cli import conda_argparse File "/Users/Can/anaconda/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 16, in from conda.cli.find_commands import find_commands, find_executable File "/Users/Can/anaconda/lib/python2.7/site-packages/conda/cli/find_commands.py", line 9, in from conda.utils import memoized File "/Users/Can/anaconda/lib/python2.7/site-packages/conda/utils.py", line 10, in import tempfile File "/Users/Can/anaconda/lib/python2.7/tempfile.py", line 32, in import io as _io File "/Users/Can/anaconda/lib/python2.7/io.py", line 51, in import _io ImportError: dlopen(/Users/Can/anaconda/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder Referenced from: /Users/Can/anaconda/lib/python2.7/lib-dynload/_io.so Expected in: dynamic lookup

How can I repair conda, without using conda itself (as I can't)?

UPDATE: I've completely uninstalled and reinstalled Anaconda. It still gives the same error. I've tried pip and it also fails with the same error. I verify it's Anaconda's pip as which pip returns /Users/Can/anaconda2/bin/pip. Why is Anaconda broken?


回答1:


I had the same issue, it is successfully fixed by just replacing the _io.so file.

sudo find / -name _io.so

copy the path of the _io.so file which DOES NOT belong to python-2.7.11. For example, copy the path of _io.so which is under python-2.7.5: /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so

Replace the '/Users/Can/anaconda/lib/python2.7/lib-dynload/_io.so' file with the _io.so that you just found.

cp /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so /Users/Can/anaconda/lib/python2.7/lib-dynload/

Then it will work.



来源:https://stackoverflow.com/questions/34589056/conda-and-pip-not-working-at-all

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!