Anaconda禁用python系统站点包

时间:2018-12-24 09:43:37

标签: python anaconda

问题

安装Anaconda后,无法访问python系统站点包。

$ python -m site
sys.path = [
    '/home/user',
    '/home/user/anaconda3/lib/python37.zip',
    '/home/user/anaconda3/lib/python3.7',
    '/home/user/anaconda3/lib/python3.7/lib-dynload',
    '/home/user/anaconda3/lib/python3.7/site-packages',
]
USER_BASE: '/home/user/.local' (exists)
USER_SITE: '/home/user/.local/lib/python3.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: True

显然,.bashrc中添加的Anaconda块引起了问题,因为没有它,我可以使用系统站点软件包。

# added by Anaconda3 5.3.1 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/home/user/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/home/user/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/home/user/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/home/user/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<

问题

我只想在环境中使用Anaconda环境及其python软件包

  1. 是否可以防止Anaconda在安装Anaconda时更改.bashrc?

  2. 在删除由Anaconda安装程序添加的.bashrc中的块后,如何激活Anaconda环境?

  3. Anaconda开发团队采用这种方式的原理是什么?

0 个答案:

没有答案