基础环境(python,gpu等)
anaconda:
清华镜像站中anaconda的所有版本的网址:Index of /anaconda/archive/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
minianaconda:Index of / (anaconda.com)
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
也可以直接在linux上下载:
选择合适的版本,右键->复制链接地址。wget + 地址就可以下载了。wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2021.11-Linux-x86_64.sh
bash Anaconda3-2021.11-Linux-x86_64.sh
conda create -n test python=3.7.5
conda activate test
conda deactivate
conda remove -n test --all # 删除创建的虚拟环境
conda create -n test --clone test2 # 复制虚拟环境
conda env list #查看虚拟环境
添加Anaconda的TUNA镜像
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
配置环境变量
通过:
vim /etc/profile
打开profile文件,在末尾添加:
PATH=$PATH:/data/home/halley/anaconda3/bin:$PATH
注意:/data/home/halley/anaconda3/bin是自己安装的路径,根据自己的情况设置。
最后更新配置:
source /etc/profile
安装需要的包
切换到使用的环境后,安装第三方库
①安装:conda install [包名]
conda install tensorflow-gpu # 安装TensorFlow
conda install numpy==1.18.5 # 指定安装版本号
②删除:conda uninstall [包名]
conda uninstall numpy
③更新:conda update [包名]
conda update numpy
(重要)复制环境依赖
这个方法一般是在复现相同环境时使用,一键快捷省心。例如更换服务器、复现git开源工程等。
①conda
conda导出已有的环境,保存在myenv.yaml文件中。
conda env export > myenv.yaml
根据yaml文件导入并安装环境
conda env create -f myenv.yaml
注:.yaml文件移植过来的环境只是原来环境里用conda install命令安装的包,pip安装的库可能不会移植过来,需要重新安装。
②pip
把环境中的依赖写入 requirement.txt 中
pip freeze >requirements.txt
安装环境依赖
pip install -r requirement.txt
1、安装
命令 "conda install jupyterlab"
Collecting package metadata (current_repodata.json): done
Solving environment: done
***
The following packages will be UPDATED:
ca-certificates 2021.7.5-h06a4308_1 --> 2021.10.26-h06a4308_2
certifi 2021.5.30-py39h06a4308_0 --> 2021.10.8-py39h06a4308_0
openssl 1.1.1k-h27cfd23_0 --> 1.1.1l-h7f8727e_0
Proceed ([y]/n)? y
***
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
2、启动
命令 “jupyter-lab“
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· Vue3状态管理终极指南:Pinia保姆级教程