ubuntu相关环境安装集合

1 ubuntu 安装CUDA

1.关闭主板BIOS的Secure Boot选项
2.执行NIVIDIA官网给出的命令

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pinsudo 
mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
sudo apt-get updatesudo apt-get -y install cuda

2.ubuntu安装ffmpeg

1.添加ffmpeg显卡支持

git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
  cd nv-codec-headers/
  make
  sudo make installhttps://blog.csdn.net/lupengCSDN/article/details/80279177

2.下载ffmpeg

从ffmpeg官网:http://ffmpeg.org/download.html下载最新的ffmpeg安装包,并解压
3.安装yasm
下载:yasm的下载链接
2)解压:把下载下来的压缩包进行解压
3)切换路径: cd yasm-1.3.0
4)执行配置: ./configure
5)编译:make
6)安装:sudo make install
4.编译和配置

cd ffmpeg-4.2.2/
ls
apt list |grep x264
sudo apt-get install libx264-dev
sudo apt-get install libx265-dev
apt list|grep sdl2

./configure --help

export PATH=$PATH:/usr/local/cuda/bin

./configure --enable-cuvid  --enable-nvenc --enable-libx264 --enable-libx265  --enable-opengl --enable-cuda-nvcc --disable-debug --disable-static --enable-shared --enable-avresample --enable-gpl --enable-nonfree --enable-version3 --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64

#6表示cpu核心
make -j6

sudo make install
sudo ldconfig

3.ubuntu安装opencv

https://blog.csdn.net/kingroc/article/details/93893828

cmake   -D CMAKE_BUILD_TYPE=RELEASE \
    -D PYTHON_DEFAULT_EXECUTABLE=$(python -c "import sys; print(sys.executable)")   \
    -D PYTHON3_EXECUTABLE=$(python -c "import sys; print(sys.executable)")   \
    -D PYTHON3_NUMPY_INCLUDE_DIRS=$(python -c "import numpy; print (numpy.get_include())") \
    -D PYTHON3_PACKAGES_PATH=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
    -D CMAKE_CXX_FLAGS="-std=c++11" \
    -D CUDA_NVCC_FLAGS="--compiler-options "-std=c++03"" \
    -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D \ WITH_QT=ON -D WITH_GTK=ON -D WITH_OPENGL=ON ..

1.从官网下载源码文件

apt list |grep cmake
sudo apt install cmake
sudo apt install cmake-curses-gui

 cd opencv-4.3.0/
 mkdir build
 cd build/
 ccmake ..

apt list|grep cmake
sudo apt install cmake-qt-gui
cmake-gui ..
make -j 6
sudo make install

2.解决opencv没有代码提示的问题
将cv2.cpython-36m-x86_64-linux-gnu.so 复制到python的site-package目录下即可

Docker相关配置
1.install https://docs.docker.com/engine/install/ubuntu/
2.sudo vim /etc/docker/daemon.json
{
"runtimes": {
"nvidia": {
"path": "nvidia-container-runtime",
"runtimeArgs": []
}
},
"registry-mirrors": [
"https://yc08i7bu.mirror.aliyuncs.com"
],
"insecure-registries": [
"192.168.x.x/24"
]
}
sudo systemctl restart dockerd
sudo systemctl restart docker
Nvidia-docker支持
https://github.com/NVIDIA/nvidia-docker

#### Test nvidia-smi with the latest official CUDA image
docker run --gpus all nvidia/cuda:10.0-base nvidia-smi

# Start a GPU enabled container on two GPUs
docker run --gpus 2 nvidia/cuda:10.0-base nvidia-smi

# Starting a GPU enabled container on specific GPUs
docker run --gpus '"device=1,2"' nvidia/cuda:10.0-base nvidia-smi
docker run --gpus '"device=UUID-ABCDEF,1"' nvidia/cuda:10.0-base nvidia-smi

# Specifying a capability (graphics, compute, ...) for my container
# Note this is rarely if ever used this way
docker run --gpus all,capabilities=utility nvidia/cuda:10.0-base nvidia-smi

pytorch 安装
1.conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
2.conda install pytorch torchvision cudatoolkit=10.0

python 通过cython打包wheel
python setup.py bdist_wheel

curl 添加代理

curl --socks5 {ip}:{port} -L https://graphics.ethz.ch/Downloads/Data/Davis/DAVIS-data.zip -o DAVIS-data.zip

shurufa sougou
https://blog.csdn.net/lupengCSDN/article/details/80279177

你可能感兴趣的:(ubuntu相关环境安装集合)