一个初始化的服务器,需要配置的相关软件以及环境(cuda、torch、conda)
创始人
2024-09-25 09:23:04
0次

文章目录

  • 一个刚初始化的服务器需要下载的应用
    • google chrome
    • ghelp
  • 解压安装包
    • 解压大型zip文件
  • 更新nvidia的驱动
  • pycharm设置
  • conda相关
    • 下载conda
    • conda换源
  • torch相关
    • 安装torch包,浏览器下载包
    • 安装pytorch
    • 常用包安装
  • 导包的方法

一个刚初始化的服务器需要下载的应用

google chrome

下载google浏览器

https://www.google.cn/intl/zh-CN/chrome/ 

ghelp

https://ghelper.net/ 

解压安装包

.tar.gz文件

tar xzvf pycharm-community-2024.1.4.tar.gz #x:解压。 #z:使用 gzip 解压。 #v:显示解压过程中的文件。 #f:指定文件名。 

.deb文件

sudo dpkg -i google-chrome-stable_current_amd64.deb 

解压大型zip文件

直接终端输入jar,找到中间版本的jar进行安装

#sudo apt install  jar -xvf filename.zip 

更新nvidia的驱动

出现nvidia-smi 指令显示不了的情况

在这里插入图片描述

pycharm设置

参考:pycharm设置

linux设置pycharm桌面图标

方法①

  • 终端输入
sudo gedit /usr/share/applications/Pycharm.desktop 
  • 然后修改打开文件的内容,将其中icon路径和exec路劲修改为你自己的路径
[Desktop Entry] Type=Application Name=Pycharm GenericName=Pycharm3 Comment=Pycharm3:The Python IDE Exec=sh /home/dell/Downloads/pycharm-community-2024.1.4/bin/pycharm.sh Icon=/home/dell/Downloads/pycharm-community-2024.1.4/bin/pycharm.png Terminal=pycharm Categories=Pycharm; 

然后就加入成功了
在这里插入图片描述

方法②
直接用命令打开pycharm后,在菜单栏的tools里面选择创建desk top entry
在这里插入图片描述

conda相关

下载conda

参考资料: Conda超详细的linux-conda环境安装教程
下载conda的链接

https://www.anaconda.com/download/success 

选择这个进行下载
在这里插入图片描述
然后终端输入bash命令安装

bash Anaconda3-2024.06-1-Linux-x86_64.sh 

conda换源

参考 conda换源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/ 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/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/  
conda config --set show_channel_urls yes 

测试看一下加的源加成功了没有

conda config --show channels 

在这里插入图片描述

通过“conda config --show-sources” 查看配置文件的路径。配置文件为用户目录下的.condarc文件

conda config --show-sources 

在这里插入图片描述
打开这个文件对里面的默认包进行修改
在这里插入图片描述
.condarc文件里面

show_channel_urls: true default_channels:   - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main   - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r   - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2 custom_channels:   conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud   msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud   bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud   menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud   pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud   pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud   simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud   deepmodeling: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/ channels:   - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/   - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/   - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/   - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge   - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/   - defaults 

换源后,如果用conda下载对应的pytorch包出现大量debug报错(这里由于pip安装torch相关的包会很慢)
那么可以选择
①降低conda-build的版本

conda install "conda-build!=3.26.0" 

②如果这样还不行,那么只能去手动的下载torch相关的包了,如下面所示

torch相关

安装torch包,浏览器下载包

这个网址找到对应的包进行下载

https://download.pytorch.org/whl/cu118 

找到这个包下载
这里各个前缀名称的含义
在这里插入图片描述

torch-2.0.1:torch的版本 cu118:cuda的版本为11.8 cp38:python的版本为3.8 

然后去到下载好这个文件的地方,右键打开终端,激活对应的虚拟环境

然后输入pip命令进行安装

#后面要加清华源下载其他依赖包 pip install torch-2.0.1+cu118-cp38-cp38-linux_x86_64.whl -i https://pypi.tuna.tsinghua.edu.cn/simple  

torch、torchvision、torchaudio
然后pip名

pip install    -i https://pypi.tuna.tsinghua.edu.cn/simple 

安装pytorch

一般是安装11.8 pytorch 为2.0.1

conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 -c pytorch -c nvidia 

常用包安装

#PIL包 pip install Pillow -i https://pypi.tuna.tsinghua.edu.cn/simple  

导包的方法

import supervision as sv  (import 的路径不能带点) from .datasets import transforms as T   (.导入当前目录或者包中的模块) from ..datasets import transforms as T (..导入上一级目录中的模块) 

相关内容

热门资讯

一分钟教你辅助!微乐小程序免费... 您好,微乐小程序免费工具这款游戏可以开挂的,确实是有挂的,需要了解加去威信【136704302】很多...
玩家必看秘籍开挂!艾牛娱乐辅助... 玩家必看秘籍开挂!艾牛娱乐辅助透视挂,北京麻将真的是有外挂,总是有挂分享1、让任何用户在无需艾牛娱乐...
科技分享透视挂!微信小程序微乐... 科技分享透视挂!微信小程序微乐辅助免费,微乐江苏小程序游戏破解器下载-果然是真的有辅助器微信小程序微...
玩家必备科普透视挂!新九游大厅... 玩家必备科普透视挂!新九游大厅辅助透视挂,天天温岭麻将是真的有外挂,都是揭秘有挂1、用户打开应用后不...
必备科技开挂!微信小程序微乐辅... 必备科技开挂!微信小程序微乐辅助器教程,微乐自建房辅助工具安全吗-确实存在有辅助教程1)微信小程序微...
指导大家辅助!荷塘辅助透视挂,... 指导大家辅助!荷塘辅助透视挂,微乐河南麻将真的有外挂,确实有挂分析指导大家辅助!荷塘辅助透视挂,微乐...
1.9分钟了解辅助!微乐家乡麻... 1.9分钟了解辅助!微乐家乡麻将辅助,微乐小程序免费黑科技-其实真的是有辅助插件1、玩家可以在微乐小...
最终开挂!微乐浙江麻将辅助透视... 最终开挂!微乐浙江麻将辅助透视挂,闲来广东麻将真的有外挂,都是真实有挂1、下载好微乐浙江麻将脚本下载...
实测发现辅助!微乐小程序黑科技... 实测发现辅助!微乐小程序黑科技免费工具,微乐家乡官方免费下载安装-本来是真的有辅助脚本1、上手简单,...
日前开挂!挖坑青海麻将辅助透视... 日前开挂!挖坑青海麻将辅助透视挂,元来黄冈麻将是真的有外挂,一贯有挂功能1、每一步都需要思考,不同水...