提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
文章目录
前言
Linux从0安装深度学习环境
提示:以下是本篇文章正文内容,下面案例可供参考
一、所需材料
一台刚刚安装完成的debian系统的电脑
二、使用步骤
1.配置Debian系统
代码如下(示例):
su-
nano /etc/sudoers
#在sudo ALL=(ALL:ALL) ALL 下面一行,xx为当前用户名
xx ALL=(ALL:ALL) ALL
2.系统换源
代码如下(示例):
nano /etc/apt/sources
修改换源,看清楚版本
#http://mirrors.163.com/debian/为软件源也可以为其他的 bullseye为版本代号 main non-free contrib区别如下
deb http://mirrors.163.com/debian/ bullseye main non-free contrib
deb http://mirrors.163.com/debian/ bullseye-updates main non-free contrib
deb http://mirrors.163.com/debian/ bullseye-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ bullseye main non-free contrib
deb-src http://mirrors.163.com/debian/ bullseye-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ bullseye-backports main non-free contrib
#deb http://mirrors.163.com/debian-security/ bullseye/updates main non-free contrib
#deb http://mirrors.ustc.edu.cn/debian-security/ bullseye/updates main non-free contrib
#deb-src http://mirrors.163.com/debian-security/ bullseye/updates main non-free contrib
#deb-src http://mirrors.ustc.edu.cn/debian-security/ bullseye/updates main non-free contrib
deb http://mirrors.ustc.edu.cn/debian-security/ stable-security main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian-security/ stable-security main non-free contrib
升级软件包、安装必要编译环境
sudo apt-get update/upgrade
sudo apt-get install build-essential
##3、安装anaconda
- 去清华镜像下载 anaconda 的软件包。下载地址
- 安装的时候输入 yes 就好,一直到安装结束
sudo dpkg install ‐i
##4、在anaconda创建新环境
#这里的Python版本根据需要所订
2 conda create ‐n new_env python=3.9
3 conda activate new_env
##5、在新环境下安装Tensorflow
- 我们在激活一个新环境后需要对该环境的 conda 进行换源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
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/msys2/
# 设置搜索时显示通道地址
conda config --set show_channel_urls yes
2)Tensoflow
conda install tensorflow
##6anaconda 新环境下安装 jupyter notebook
conda install jupyter notebook
conda install ipykernel
其他问题总结
1、安装第三方包的时候有三种方法可以安装 conda、pip、poetry。最好避免 使用 pip 安装,因为会缺少很多依赖导致安装不成。因此应当首选 conda,其次 poetry(如果在开发文档给出该方法安装),最后在考虑pip安装。用pip安装时 一定要换源,具体使用方法pip install ‐i 包名 https://pypi.douban.com/ simple/
2、在出现问题No module name ’xxx’,这个问题有统一解决方法。
pip install xxx ‐i https://pypi.douban.com/simple/。如果这个方案依然解决不了,就说明缺少一些依赖。此时需要认真阅读相应出错地方,百度获取一些包的依赖。
3、在出问题的时候,overstackflow 是一个好网站,就是比较慢