After Anaconda installation, conda command fails with “ImportError: no module named conda.cli”

匿名 (未验证) 提交于 2019-12-03 02:03:01

问题:

I installed 64 bit Linux version of Anaconda recently (1.8.0-Linux-x86_64). The installation seemed to work fine:

$ python  Python 2.7.5 |Continuum Analytics, Inc.| (default, Nov  4 2013, 15:30:26) [GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy >>> ##No issues here  

However if I try any of the conda commands, I get an error:

$ conda info Traceback (most recent call last):   File "~/anaconda/bin/conda", line 3, in      from conda.cli import main ImportError: No module named conda.cli 

Installation is under my user directory (~/anaconda). I have verified that $PATH contains ~/anaconda/bin. $PYTHONPATH is also set to ~/anaconda/lib.

Any thoughts on what is wrong with the 'conda' command? My searches do not appear to show any one else reporting this error.

回答1:

When you were installing it, you missed a section. When conda asked you if it can set your .bashrc file, you probably clicked NO. It's a simple fix: fire up your interpreter and add this line:

export PATH=/home/add your username here/anaconda/bin:$PATH

Now type python into the interpreter and you will see Anaconda 1.8.0 or whatever version you have. You will have to do this each time you start a new interpreter.

Enjoy!



回答2:

If anaconda was installed by the root user, a permissions issue could produce the ImportError: No module named 'conda.cli' error.

Something like this

sudo chown -R [username] [anaconda_dir]

would help in that case.

Alternatively, the conda install could be cloned to another location, such as the user's home directory:

conda create -n [my_conda_root] --clone=[current_conda_dir]

But for this to work, you will need at least the read and traverse permissions.



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