ubuntu18.04配置CUDA,anaconda,golang,pycharm,goland,opencv等

1、ubuntu-drivers devices
查看最新驱动
一定要查看以下因为比如比较老的显卡如1050,如果不安装最新驱动是无法正常安装比较新的CUDA
1050默认CUDA9.1,直接安装CUDA新版本会失败
2、sudo ubuntu-drivers autoinstall
安装的是最新的450,可以安装CUDA10
3、https://developer.nvidia.com/cuda-10.0-download-archive

sudo sh cuda_10.0.130_410.48_linux.run(安装下载的版本)
因为驱动已经更新为最新驱动,所以不用安装,把驱动那个选项取消

会提示:

***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 384.00 is required for CUDA 10.0 functionality to work.

To install the driver using this installer, run the following command, replacing with the name of this run file:

sudo .run -silent -driver

没有选择安装驱动,忽略就行。

sudo vim ~/.bashrc
在末尾加入
export CUDA_HOME=/usr/local/cuda
export PATH= P A T H : PATH: PATH:CUDA_HOME/bin
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64KaTeX parse error: Expected '}', got 'EOF' at end of input: …LIBRARY_PATH:+:{LD_LIBRARY_PATH}}
保存退出
source ~/.bashrc
关闭终端,在打开一个新的终端
nvidia-smi
nvcc -V
都正确显示信息,成功
4.cudnn install
下载对应所安装的cuda版本的cudnn,解压缩,然后
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

5.ubuntu 安装 anaconda3,anaconda清华镜像下载(百度搜索)别用最新版
bash Anaconda3-5.2.0-Linux-x86_64.sh
sudo gedit ~/.bashrc
export PATH="/home/bzfbee/anaconda3/bin:KaTeX parse error: Expected 'EOF', got '#' at position 375: …=/usr/local/go #̲GOROOT是系统上安装Go软…GOPATH/bin: G O R O O T / b i n : GOROOT/bin: GOROOT/bin:PATH
source ~/.bashrc
export
go version
7.下载PyCharm安装包(可以下载免费版)
创建快捷方式
先用脚本打开pycharm
在./pycharm/bin
输入sh pycharm.sh
pycharm打开后点击任务栏:
tools---->create desktop entry.
把应用程序里面的图标拖拽到左边任务栏
8.下载goland安装包(怎么破解自己搜索一下吧,某宝上面也有)
创建快捷方式
先用脚本打开goland
/GoLand/bin
输入sh goland.sh
goland打开后点击任务栏:
tools---->create desktop entry.
把应用程序里面的图标拖拽到左边任务栏
安装git
apt-get install git
9.安装opencv
先安装依赖
sudo apt-get install libvtk7-dev
sudo apt install build-essential cmake git pkg-config libgtk-3-dev
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev
gfortran openexr libatlas-base-dev python3-dev python3-numpy
libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev
libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
下载源代码
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git
把源代码下载到你希望的文件夹中,并将opencv_contrib库移到opencv文件夹下
cd ~/opencv3.4.9
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -DWITH_VTK=ON -D OPENCV_EXTRA_MODULES_PATH=/home/bzfbee/opencv-3.4.9/opencv_contrib-3.4.9/modules …
make
/*
错误:
/home/bzfbee/opencv-3.4.4/opencv_contrib-3.4.4/modules/xfeatures2d/src/boostdesc.cpp:653:20: fatal error: boostdesc_bgm.i: 没有那个文件或目录
查看build文档下的CMakeDownloadLog.txt文件,搜索boostdesc_bgm.i,Log里有它的下载地址,直接复制地址到网页可以得到文件的源码,直接在 opencv_contrib/modules/xfeatures2d/src/ 路径下并拷贝其源码即可。
链接: https://pan.baidu.com/s/1eKfEha77FoI7fF8UVJqBwQ 密码: pqv6
–来自百度网盘超级会员V4的分享,
不知何时会失效
总共缺了以下几个文件:
boostdesc_bgm.i
boostdesc_bgm_bi.i
boostdesc_bgm_hd.i
boostdesc_lbgm.i
boostdesc_binboost_064.i
boostdesc_binboost_128.i
boostdesc_binboost_256.i
vgg_generated_120.i
vgg_generated_64.i
vgg_generated_80.i
vgg_generated_48.i
错误:
matchers.hpp:52:12: fatal error: opencv2/xfeatures2d/cuda.hpp: 没有那个文件或目录
52 | # include “opencv2/xfeatures2d/cuda.hpp”
[Makefile:163:all] 错误 2
其实文件都在,就是找不到路径,在报错的文件位置,修改为绝对路径:
找到matchers.hpp文件,用文本编辑器打开,第52行,
/home/(你自己的)/opencv-3.4.9/opencv_contrib-3.4.9/modules/xfeatures2d/include/opencv2/xfeatures2d/cuda.hpp

*/
sudo make install
sudo gedit /etc/ld.so.conf.d/opencv.conf
执行此命令后打开的可能是一个空白的文件,不用管,只需要在文件末尾添加 /usr/local/lib
sudo ldconfig
sudo gedit /etc/bash.bashrc
在最末尾添加
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
source /etc/bash.bashrc
sudo updatedb
pkg-config --modversion opencv

你可能感兴趣的:(学习,ubuntu,cuda,python,linux,go)