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/