墙内搭建高效的Conda开发环境

栏目: Python · 发布时间: 5年前

内容简介:配置环境:Ubuntu服务器,版本号 16.04.4,Python 3.7.3。Conda3 + Python3.7下载安装脚本:

配置环境:Ubuntu服务器,版本号 16.04.4,Python 3.7.3。

Conda3 + Python3.7

  1. 清华源下载Conda安装脚本;
  2. 修改激活脚本,避免污染 Python 路径;
  3. 修改Conda的下载源;

安装Conda

下载安装脚本: Anaconda3-2019.03-Linux-x86_64.sh

参考清华conda源

版本信息:

cat /proc/version
Linux version 4.4.0-87-generic (buildd@lcy01-31) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017

python3.7 --version
Python 3.7.3
复制代码

执行安装脚本:

sudo bash Anaconda3-2019.03-Linux-x86_64.sh
复制代码

参数:

  1. 是否同意协议; -> yes
  2. 安装位置; -> 自定义位置,新建文件夹
  3. 是否启动初始化; -> yes

添加激活脚本

避免每次开机启动,移动 .bashrc 中的启动命令:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/data1/wcl/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/data1/wcl/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/data1/wcl/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/data1/wcl/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<
复制代码

新建激活脚本 activate_conda.sh ,激活和解除激活:

source activate_conda.sh
conda deactivate
复制代码

修改Conda源

修改conda的安装源:

conda config --add channels  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes
复制代码

配置文件 .condarc

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - defaults
show_channel_urls: true
复制代码

OK, that's all!


以上所述就是小编给大家介绍的《墙内搭建高效的Conda开发环境》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Python for Data Analysis

Python for Data Analysis

Wes McKinney / O'Reilly Media / 2012-11-1 / USD 39.99

Finding great data analysts is difficult. Despite the explosive growth of data in industries ranging from manufacturing and retail to high technology, finance, and healthcare, learning and accessing d......一起来看看 《Python for Data Analysis》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试