Anaconda指的是一个开源的Python发行版本,其包含了conda、Python等180多个科学包及其依赖项,可以用于在同一个机器上安装不同版本的软件包及其依赖,并能够在不同的环境之间切换。
有了
环境:
阿里云服务器,CentOS 7.7
1.Anaconda官网下载anaconda
这里我们选择Linux版本的Anaconda
下载好通过Xshell工具传送文件至服务器
选择文件传送
2.安装Anaconda
bash Anaconda3-2019.10-Linux-x86_64.sh
按照提示一步步安装即可,这里选择的是默认路径安装
配置Anaconda环境变量
vim /etc/profile
/etc/profile配置文件中添加环境变量:PATH=/root/anaconda3/bin:$PATH(填写自己的anaconda路径)
for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do
if [ -r "$i" ]; then
if [ "${-#*i}" != "$-" ]; then
. "$i"
else
. "$i" >/dev/null
fi
fi
done
PATH=/root/anaconda3/bin:$PATH
unset i
unset -f pathmunge
编译当前终端环境变量
source /etc/profile
终端输入python测试,成功搭建好Anaconda环境
3.conda/pip换清华源
conda换源:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
或者直接修改~/.conndarc配置文件为以下内容
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
show_channel_urls: true
pip换源:
修改~/.pip/pip.conf配置文件indx-url
index-url = https://pypi.mirrors.ustc.edu.cn/simple/