深度学习环境--ubuntu.txt

guanghui-hua / 2024-03-12 / 原文

sudo apt install cifs-utils
sudo mount -t cifs -o uid=yudi,username=Program,password=XXX,iocharset=utf8,vers=2.0 //192.168.3.67/Program /home/yudi/Program
sudo mount -t cifs -o uid=rtx4090,username=NAS918,password=,iocharset=utf8,vers=2.0 //192.168.2.40/3.Learning /home/rtx4090/3.Learning
pgyvisitor login -u yudi2567 -p A

conda activate Pytorch-cu118-1
conda activate cu116-1
taskset -c 0,1,2,3 python main.py
taskset -c 0,1 python main.py
#######################################################################################
1.	复制环境
conda create -n B --clone A

2.	查看环境
conda env list
3.	删除虚拟环境
conda remove -n your_env_name --all
conda remove -n DL3.10-1.12.1 --all

jupyter kernelspec list
jupyter kernelspec remove kernelname



#######################################################################################
监控显卡占用情况
watch -n 2 nvidia-smi
cpupower 安装
sudo apt install linux-tools-common
CPU实时频率查看
watch -n 1 sudo cpupower monitor
查看cpu频率
watch -n 0 "cat /proc/cpuinfo | grep -i mhz"
查看cpu频率模式
cpupower frequency-info
查看当前所有CPU的信息
sudo cpupower -c all frequency-info
查看intel睿频的使能情况
cat /sys/devices/system/cpu/intel_pstate/no_turbo
查看内核支持的cpu策略
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
查看当前策略
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
设置所有CPU为性能模式
sudo cpupower -c all frequency-set -g performance
设置所有CPU为节能模式
sudo cpupower -c all frequency-set -g powersave

bash
#sudo dpkg -i

1.	安装anaconda 
	新建文件夹Anaconda3,并将安装文件移入。执行 bash 文件名
2.	pip国内源:
	在user目录中创建一个pip目录
	sudo gedit pip.conf

[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = https://pypi.tuna.tsinghua.edu.cn

3.	conda:国内源,在cmd终端输入下列命令:

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/pkgs/r
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/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/cloud/msys2 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/simpleitk

#######################################################################################
Pytorch-cu118-1
安装好Anaconda3后,建议立即建一个虚拟环境。在cmd中执行
conda create -n Pytorch-cu118-1 python=3.10
conda activate Pytorch-cu118-1
#conda deactivate Pytorch-cu118-1 #退出虚拟环境
conda install cudatoolkit=11.8
conda install cudnn
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia

pip3 install opencv_python
pip3 install scipy
pip3 install scikit-learn
pip3 install matplotlib
pip3 install pandas
pip3 install tqdm


pip3 install jupyterlab
pip3 install ipykernel
python -m ipykernel install --user --name Pytorch-cu118-1 --display-name "Pytorch-cu118-1"
pip3 install ipywidgets widgetsnbextension pandas-profiling
jupyter nbextension enable --py widgetsnbextension

#######################################################################################
Pytorch_TensorFlow-cu117-1
安装好Anaconda3后,建议立即建一个虚拟环境。在cmd中执行
conda create -n cu117-1 python=3.10
conda activate cu117-1
#conda deactivate cu117-1 #退出虚拟环境
conda install cudatoolkit=11.7
conda install cudnn
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
pip3 install tensorflow-gpu 文件(2.11)

pip3 install opencv_python
pip3 install scipy
pip3 install scikit-learn
pip3 install matplotlib
pip3 install pandas
pip3 install tqdm


pip3 install jupyterlab
pip3 install ipykernel
python -m ipykernel install --user --name cu117-1 --display-name "cu117-1"
pip3 install ipywidgets widgetsnbextension pandas-profiling
jupyter nbextension enable --py widgetsnbextension

#######################################################################################
Pytorch_TensorFlow-cu116-1
安装好Anaconda3后,建议立即建一个虚拟环境。在cmd中执行
conda create -n cu116-1 python=3.10
conda activate cu116-1
#conda deactivate cu116-1 #退出虚拟环境
conda install cudatoolkit=11.6
conda install cudnn
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.6 -c pytorch -c conda-forge
pip3 install tensorflow-gpu 文件(2.11)

pip3 install opencv_python
pip3 install scipy
pip3 install scikit-learn
pip3 install matplotlib
pip3 install pandas
pip3 install tqdm


pip3 install jupyterlab
pip3 install ipykernel
python -m ipykernel install --user --name cu116-1 --display-name "cu116-1"
pip3 install ipywidgets widgetsnbextension pandas-profiling
jupyter nbextension enable --py widgetsnbextension


#######################################################################################
生成配置文件(anaconda prompt )
jupyter notebook --generate-config
#######################################################################################
查找:# c.NotebookApp.notebook_dir = ''
c.NotebookApp.notebook_dir = ''
######################################################################################

#######################################################################################
#######################################################################################
pip3 install imageio
pip3 install sympy
conda install -c plotly plotly-orca
pip3 install psutil
pip3 install h5py
pip3 install filelock

安装JupyterLab
conda install jupyterlab
conda install ipykernel

conda install -c conda-forge jupyter
conda install -c conda-forge jupyterlab

python -m ipykernel install --name Torch1.13.0-11.6-1
conda install ipywidgets widgetsnbextension pandas-profiling
jupyter nbextension enable --py widgetsnbextension

sudo gedit /home/dell/.jupyter/jupyter_notebook_config.py
c.NotebookApp.notebook_dir = '/home/dell/Wendy/PyCharm'