anaconda ubuntu安装

1、下载anaconda

地址:https://www.anaconda.com/download#downloads
anaconda ubuntu安装_第1张图片
我是x86 64位系统,所以选择第一个

2、安装

执行命令:

sh Anaconda3-2023.03-1-Linux-x86_64.sh

中间会有几个过程
enter 确定
yes 确定
最后默认安装位置为: ~/anaconda3,这里可以自己输入,建议就直接回车好了
anaconda ubuntu安装_第2张图片
这里高亮的话会有个false,那句话时如果不想启动终端时直接进入conda,可以通过 conda config --set auto_activate_base false 设置,我开始一度以为中间哪里出错了。

3、配置conda 环境

vim ~/.bashrc

最后一行增加如下内容

export PATH=“~/anaconda3/bin:$PATH”

然后执行

source ~/.bashrc

4、检查是否安装成功

conda --version
可以查看版本号

5、配置镜像

然后就是配置镜像,毕竟,python不配镜像简直是慢到他姥姥家了。

conda config --remove-key channels
conda config --add channels - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --set show_channel_urls yes
conda config --show channels

然鹅,在创建环境时报错了

报错信息:

“CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/current_repodata.json>

注意,一通查之后在
https://blog.csdn.net/duduhanna/article/details/121380007
中找到了解决方案,只需要在镜像后面增加系统的类型就好
anaconda ubuntu安装_第3张图片
另外需要改为http,不能用https。(但是我用了https 貌似并没有什么问题)
修改如下

conda config --remove-key channels
conda config --add channels - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64
conda config --add channels - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64
conda config --set show_channel_urls yes
conda config --show channels

注:这里也可以通过修改 .condarc 配置文件 进行修改(推荐)

vim .condarc

anaconda ubuntu安装_第4张图片

ok,再执行conda create -n envname python=3.* 就莫有问题了

其他问题

在conda install的时候也遇到了别的问题
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
问了chatgpt:
给了以下解决方案:
1、conda update conda(这里只能在base环境中运行)
2、如果更新不起作用 可以尝试清理缓存,然后重新安装
conda clean --all
但是在我把虚拟环境删掉,重装了一次之后就没问题了。不知道怎么解决的

注:上面的顺序最好不要弄错了,因为前面测试了好多次。按照顺序就可以避坑。

你可能感兴趣的:(手握神器,ubuntu,python,linux)