1. Windows下安装
由于Anaconda集成了大部分的python包,因此能够很方便的开始使用。由于网络下载速度较慢,因此推荐使用镜像来提高下载的速度。镜像的使用方法可以参考:Anaconda镜像的说明文档。
- 在这里找到适合自己的安装文件,然后下载;
例如:https://mirrors.bfsu.edu.cn/anaconda/archive/Anaconda3-2020.11-Windows-x86_64.exe - 按照说明,安装Anaconda。
2. Linux下安装
在网站下载最新的conda安装文件,例如:
wget https://mirrors.bfsu.edu.cn/anaconda/archive/Anaconda3-2020.11-Linux-x86_64.sh
然后运行:
bash ./Anaconda3-2020.11-Linux-x86_64.sh
按照提示完成安装(记得需要自动加入环境变量的设置),最后需要重启终端。
3. 配置软件源
3.1 设置conda软件源
可以参考conda安装和软件源设置说明。
各系统都可以通过修改用户目录下的 .condarc
文件。Windows 用户无法直接创建名为 .condarc
的文件,可先执行 conda config --set show_channel_urls yes
生成该文件之后再修改。
Linux下,打开文件编辑器 gedit ~/.condarc
,然后把下面的内容拷贝到这个文件中:
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/main
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/r
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.bfsu.edu.cn/anaconda/cloud
msys2: https://mirrors.bfsu.edu.cn/anaconda/cloud
bioconda: https://mirrors.bfsu.edu.cn/anaconda/cloud
menpo: https://mirrors.bfsu.edu.cn/anaconda/cloud
pytorch: https://mirrors.bfsu.edu.cn/anaconda/cloud
pytorch-lts: https://mirrors.bfsu.edu.cn/anaconda/cloud
simpleitk: https://mirrors.bfsu.edu.cn/anaconda/cloud
3.2 设置PIP源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
4. 安装常用软件包
打开 conda
的命令行程序,输入下面的命令:
conda install jupyter scipy numpy sympy matplotlib pandas scikit-learn
安装PyTorch:
conda install pytorch -c pytorch
pip3 install torchvision