Conda
下载
注:下载被拒绝, 需要添加 user-agent
wget --user-agent="Mozilla" https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2024.02-1-Linux-x86_64.sh
安装
sh Anaconda3-2024.02-1-Linux-x86_64.sh # 大小 998M
Do you wish to update your shell profile to automatically initialize conda?
输入: yes
# 安装之后, 重新打开shell生效 / 或 bash 进入 conda 环境
# 常用配置
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
Conda 常用命令
// conda 自身管理
conda --version
conda info
conda info --envs | conda info -e | conda env list # 列出所有环境
python --version
conda create --help # create 命令的帮助信息
conda update conda # 需要管理员权限
conda config --show
conda config --get channels
conda config --set auto_activate_base false
# 设置搜索时显示通道地址
conda config --set show_channel_urls yes
# 设置清华镜像
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
# 设置 bioconda
conda config --add channels bioconda
conda config --add channels conda-forge
# 移除 bioconda
conda config --remove channels bioconda
# 换回默认源
conda config --remove-key channels
// conda 环境管理
conda create --name tensorflow python=3.12.3 # 创建环境 tensorflow
conda create -n XXX -y # 确认创建名为 XXX 的环境 conda
activate tensorflow | conda activate tensorflow # 激活环境 tensorflow
deactivate | conda deactivate # 退出当前环境
conda env remove -n noti # 删除指定环境
conda remove --name tensorflow --all # 删除环境 tensorflow
conda remove --name tensorflow --zlib # 删除环境 tensorflow 中的 zlib 包
// conda 包管理
conda list # 查看环境中的所有包
conda search XXX # 查询 XXX 包
conda list XXX # 查看是否安装 XXX 包(支持 * 通配符)
conda install XXX # 安装 XXX 包
conda install XXX=0.2.0 # 安装/变更指定版本 XXX 包
conda install XXX=0.2.0 -c conda_forge # 从conda_forge通道channel安装指定版本 XXX 包
conda update XXX # 更新 XXX 包
conda uninstall XXX # 删除 XXX 包
conda remove XXX # 删除 XXX 包
conda env remove -n XXX # 删除 XXX 包
conda clean -all -y # 删除所有的安装包及cache(索引缓存、锁定文件、未使用过的包和tar包)
jupyter notebook
- 配置工作目录:
- 生成配置文件
jupyter notebook --generate-config
在Windows 用户文件夹 C:\Users\Administrator 生成了子文件夹 .jupyter,并在其中生成了 Jupyter Notebook 配置文件:jupyter_notebook_config.py,配置文件中配置设定为默认配置。
修改配置项 c.ServerApp.root_dir 为自己的目录,如
c.ServerApp.root_dir = 'D:/CodeJupyter'
- 修改快捷方式
Jupyter Notebook 属性, 目标 尾部的 "%USERPROFILE", 删除之