我在我的笔记本电脑上运行Ubuntu19.10,我最近安装了miniconda3。到目前为止没有问题,但是在用Python2.7创建环境之后,每次打开终端时都会收到以下消息:
Command 'python' not found, but can be installed with:
sudo apt install python3 # version 3.7.5-1, or
sudo apt install python # version 2.7.17-1
sudo apt install python-minimal # version 2.7.17-1
所以我按照建议安装了python,然后出现了这个错误:
^{pr2}$我猜bash正在尝试访问condapython2.7?
以下是我在没有conda active的情况下运行which python
得到的结果:
激活conda后,相应的结果如下:
which python
/home/rustax/miniconda3/bin/python
which python3
/home/rustax/miniconda3/bin/python3
whereis python
python: /usr/bin/python2.7 /usr/bin/python3.7 /usr/bin/python3.7m /usr/bin/python /usr/lib/python3.8 /usr/lib/python2.7 /usr/lib/python3.7 /etc/python2.7 /etc/python3.7 /etc/python /usr/local/lib/python2.7 /usr/local/lib/python3.7 /usr/include/python3.7m /usr/share/python /home/rustax/miniconda3/bin/python3.7-config /home/rustax/miniconda3/bin/python3.7m /home/rustax/miniconda3/bin/python3.7 /home/rustax/miniconda3/bin/python3.7m-config /home/rustax/miniconda3/bin/python /usr/share/man/man1/python.1.gz
我尝试创建一个从/home/rustax/miniconda3/bin/python到/usr/bin/python的符号链接,但是出现了相同的错误。在
Conda将以下行添加到.bashrc:
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/rustax/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/rustax/miniconda3/etc/profile.d/conda.sh" ]; then
. "/home/rustax/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/home/rustax/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
提前感谢您能提供的任何帮助
很抱歉这么麻烦,但我已经解决了问题。由于Ubuntu19.10没有预装python2,为了解决这个问题,我首先删除了python(因为我在安装conda之后安装了它,注意这是python而不是python3,因为python3是预装的)和conda。在
python我安装后
^{pr2}$在安装了python之后,我以正常的方式安装了conda,现在打开一个终端时不会收到任何错误消息。我想路径变量的顺序很重要。当我遇到麻烦的时候,我首先安装了conda,然后安装了python,并认为condaspythonpath可能是第一位的。在
相关问题 更多 >
编程相关推荐