赞
踩
使用:
vim ~/.bashrc
输入:
export PATH=~/anaconda3/bin:$PATH
退出后执行:
source ~/.bashrc
此时在终端中输入python
xxx@xxx-ThinkCentre-M730e-N010:~$ python
Python 3.9.12 (main, Apr 5 2022, 06:56:58)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
如果输出中有Anaconda
则表明环境配置成功
但是如果此时输入conda activate
则报错如下
xxx@xxx-ThinkCentre-M730e-N010:~$ conda activate CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. To initialize your shell, run $ conda init <SHELL_NAME> Currently supported shells are: - bash - fish - tcsh - xonsh - zsh - powershell See 'conda init --help' for more information and options. IMPORTANT: You may need to close and restart your shell after running 'conda init'.
原因是没有启动conda.sh
,该文件在~/anaconda3/etc/profile.d/conda.sh
目录下
方法1:
source activate
然后就可以执行
conda activate xxx_env
方法2:
使用:
vim ~/.bashrc
输入:
export PATH=~/anaconda3/bin:$PATH
source ~/anaconda3/etc/profile.d/conda.sh
退出后执行:
source ~/.bashrc
然后就可以执行
conda activate
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。