问题描述
我按照以下说明将conda(而不是anaconda)直接安装到正在使用的服务器上
I installed conda, not anaconda, directly onto a server I am working on using the following instructions
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh
bash Miniconda2-latest-Linux-x86_64.sh
install to $HOME/.miniconda2
edit ~/.bashrc
Add this line:
export PATH="$HOME/.miniconda2/bin:$PATH"
source ~/.bashrc
conda install pip
当conda安装程序询问我是否要将路径添加到我的.bashrc文件时,我说了是,它添加了 export PATH ="/home/r/rhlozek/binesh/miniconda2/bin:$ PATH"
When the conda installer asked me if I want to add the path to my .bashrc file I said yes and it added export PATH="/home/r/rhlozek/binesh/miniconda2/bin:$PATH"
但是,只要我尝试执行 conda安装pip
我得到
However whenever I try to do conda install pip
I get
跟踪(最近一次通话结束):< module>中的文件"/home/r/rhlozek/binesh/miniconda2/bin/conda",第4行.导入conda.cliImportError:没有名为conda.cli
当其他人遇到此问题时,是他们在conda安装程序要求他们编辑其.bashrc文件时说否",但是我对它说是",所以现在我不知道为什么会遇到这个问题问题.
When other people have this issue is when they say "No" to when the conda installer asks them to edit their .bashrc file, but i say Yes to it so now I don't know why I'm running into this problem.
推荐答案
似乎您的PYTHONPATH设置不正确.进行检查:
Looks like your PYTHONPATH is not properly set. Check it with:
python
...
>>> import sys
>>> sys.path
其中应该有一堆路径.大约6到10个条目似乎是明智的.实际数量取决于您自己的设置.我目前没有可用的Linux进行测试.如果此列表为空,非常短或仅包含前缀不是/home/r/rhlozek/binesh/miniconda2
的路径,则表示有问题.
It should have a bunch of paths in there. Something like 6 to 10 entries seem sensible. The actual number depends on your own settings. I don't have Linux available right now to test it. If this list is empty, very short, or contains only paths with prefixes other than /home/r/rhlozek/binesh/miniconda2
, you have problem.
尝试:
- 启动一个新的终端窗口,查看问题是否消失并且PYTHONPATH变长
-
通过以下方式手动添加路径:
- to start a new terminal window and see if the problem goes away and thePYTHONPATH gets longer
add paths manually with:
export PYTHONPATH="$HOME/.miniconda2/lib/python2.7:$HOME/.miniconda2/lib/python2.7/site-packages:$PYTHONPATH"
(检查系统上的实际路径)
(Check for the actual path on your system)
source ~/.bashrc
这篇关于Conda ImportError:没有名为conda.cli的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!