1、下载
在miniconda官方网站上下载对应的Linux版本,之后上传到Linux上。
(或者用wget直接在Linux上下载,没试过)
wget https://mirrors.tuna.tsinghua.edu/anaconda/miniconda/Miniconda3-4.3.14-Linux-x86_64.sh
2、安装
使用 bash Miniconda3-4.3.14-Linux-x86_64.sh 执行并安装。
按照提示安装,基本就是按回车,再输入几个yes(同意条款和选择安装路径等)即可。
安装完成后重启。
3、配置环境变量
安装完成后进入 ~/.bashrc 中查看是否添加用户环境变量。(安装时可能已经配置好)
使用conda -h 查看是否安装完成。(也可通过查看命令行前端是否有(base)进行判断)
若无法使用,显示conda: commond not found,可尝试使用source ~/.bashrc 命令使该文件生效。
关闭自动进入conda环境:conda config --set auto_activate_base false
4、更换pip源(清华镜像源)
在用户家目录下创建.pip文件夹 mkdir ~/.pip
在文件夹中创建文件pip.conf,并输入
[global]
index-url = https://pypi.tuna.tsinghua.edu/simple
5、更换conda源
conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/pkgs/main/
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/cloud/pytorch/
可以通过vim ~/.condarc查看已经添加的channels
之后使用conda命令安装时注意去除 -c pytorch,安装时才会默认使用清华镜像源。
6、创建新的conda环境
conda create -n xxx python=xxx
创建成功后通过conda activate xxx进入,之后在新创建的环境中安装pytorch和所需包等。
可通过conda info --envs查看已有环境
删除环境
conda remove -n 环境名 --all
7、安装pytroch环境
直接上pytorch官网查找,使用对应命令即可下载。
8、导入包
切换到所需的conda环境,通过pip install 安装所需的包
更多推荐
Linux安装miniconda
发布评论