树莓派 更换国内源,安装vim,berryconda,opencv

更换国内源(中科大)

sudo -s
echo -e "deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi \n deb-src http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi" > /etc/apt/sources.list
echo -e "deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/ stretch main ui" > /etc/apt/sources.list.d/raspi.list
exit
sudo apt update && sudo apt -y upgrade

其他源

中山大学 Raspbian http://mirror.sysu.edu.cn/raspbian/raspbian/
清华大学 Raspbian http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/
华中科技大学 Raspbian http://mirrors.hustunique.com/raspbian/raspbian/ Arch
Linux ARM http://mirrors.hustunique.com/archlinuxarm/
大连东软信息学院源(北方用户) Raspbian
http://mirrors.neusoft.edu.cn/raspbian/raspbian/
重庆大学源(中西部用户) Raspbian http://mirrors.cqu.edu.cn/Raspbian/raspbian/

安装vim

sudo apt-get install -y vim

如果出现vim : 依赖: vim-common (= 2:7.3.547-7+deb7u4) 但是 2:8.0.0197-4+deb9u1 正要被安装
则先卸载vim-common再安装vim

sudo apt-get remove vim-common
sudo apt-get install -y vim

中文输入法

sudo apt-get install -y ttf-wqy-zenhei
sudo apt-get install -y scim-pinyin

安装Berryconda

https://github.com/jjhelmus/berryconda

下载Berryconda3-2.0.0-Linux-armv7l.sh
在文件路径下

chmod +x Berryconda3-2.0.0-Linux-armv7l.sh
./Berryconda3-2.0.0-Linux-armv7l.sh

其基本操作与Anaconda一致。

conda环境中安装OpenCV

在conda环境中通过下面的命令一键式安装OpenCV

conda install -c menpo opencv

但是

import cv2
import numpy as np

# 图片的分辨率为200*300,这里b, g, r设为随机值,注意dtype属性
b = np.random.randint(0, 255, (200, 300), dtype=np.uint8)
g = np.random.randint(0, 255, (200, 300), dtype=np.uint8)
r = np.random.randint(0, 255, (200, 300), dtype=np.uint8)

# 合并通道,形成图片
img = cv2.merge([b, g, r])

# 显示图片
cv2.imshow('test', img)
cv2.waitKey(0)
cv2.destroyWindow('test')

运行出错:

/home/jhelmus/conda/conda-bld/opencv_1512148862464/work/modules/highgui/src/window.cpp:605: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvShowImage

树莓派编译安装opencv3的教程

https://blog.csdn.net/Fighting_Boom/article/details/82215362
树莓派 更换国内源,安装vim,berryconda,opencv_第1张图片

你可能感兴趣的:(树莓派)