将Anaconda 安装在个人用户下并设置环境变量
目录
首先,下载Anaconda
https://www.anaconda.com/products/distribution#linux
然后,开始安装Anaconda
In the terminal, run the following:
bash Anaconda3-2022.10-Linux-x86_64.sh
同意安装协议看,同意(yes)
设置安装路径
Anaconda3 will now be installed into this location:
/home/xxx/Tools/anaconda3/2022.10
设置环境变量
Do you wish the installer to initialize Anaconda3 in your .bashrc? [yes or no]
no
Do you wish to update your shell profile to automatically initialize conda?
This will activate conda on startup and change the command prompt when activated.
If you'd prefer that conda's base environment not be activated on startup,
run the following command when conda is activated:
conda config --set auto_activate_base false
You can undo this by running `conda init --reverse $SHELL`? [yes|no]
[no] >>>
You have chosen to not have conda modify your shell scripts at all.
To activate conda's base environment in your current shell session:
eval "$(/home/langyang/Tools/ananconda3/2024.02/bin/conda shell.YOUR_SHELL_NAME hook)"
To install conda's shell functions for easier access, first activate, then:
conda init
Thank you for installing Anaconda3!
我们选用modulefiles来设置环境变量
modulefile名称为2022.10.lua,2022.10.lua文件内容为:
-- Local variables
local base = "/home/xxx/Tools/anaconda3/2022.10"
local version = "2022.10"
local pkgName = "anaconda3"
local pkg = pathJoin(base,"bin")
--Take care of $PATH
prepend_path("PATH",pkg)
-- Setup Modulepath for packages
local mroot = os.getenv("MODULEPATH_ROOT")
local mdir = pathJoin(mroot,pkgName,version)
prepend_path("MODULEPATH",mdir)
调用环境变量
module use /home/xxx/Tools/modulefiles
module load anaconda3/2022.10
这样就可以使用anaconda3/2022.10的jupyter-notebook了。