系统:Ubuntu18.04 虚拟机VMWare10
1、先更换Ubuntu的源,更换为国内源:
第一步:安装vim (vi我是真的用不习惯) sudo apt-get install vim
第二步:vim /etc/apt/sources.list
打开之后,在文本的最前端添加源网站(我选择的是国内的阿里源),如下:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
第三步:sudo apt-get update
sudo apt-get upgrade 这两句话,更新各种资源(有点久)
2、安装python(这个Ubuntu18.04自带了python3.6,若是没有的可以百度教程,不在赘述)
3、安装pip(安装包管理):
第一步:换源
修改 ~/.pip/pip.conf (没有就创建一个), 内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
第二步:sudo install python3-pip
4、安装opencv
sudo apt install libopencv-dev python3-opencv
安装好之后查看opencv的版本:
pkg-config --modversion opencv
应该会显示对应的版本号
5、安装tensorflow
pip3 install tensorflow
结束语:大致的开发环境已经搭建好,以后有需要可以再添加。