我尝试在我的覆盆子pi 4上安装opencv。
pip install opencv-python我得到以下错误
查看索引:https://pypi.org/simple,https://www.piwheels.org/simple收集opencv-python错误:无法找到满足要求的opencv-python (版本:无)错误:没有找到与opencv-python匹配的发行版。
我使用2019-07-10-Raspbianbuster-满
$ python -VPython 3.7.3
$ pip --versionpip 19.2.1来自/home/pi/envs/django_env/lib/python3.7/site-packages/pip (python3.7)
我看到了一些推荐的方法,但都没有奏效:
sudo pip3 install opencv-contrib-python==3.4.4.19https://www.pyimagesearch.com/2018/09/19/pip-install-opencv/
$ sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-100
$ sudo apt-get install libqtgui4 libqtwebkit4 libqt4-test python3-pyqt5
$ sudo apt-get install libatlas-base-dev
$ sudo apt-get install libjasper-dev
pip install opencv-contrib-python我记得它总是适用于我的其他覆盆子pis (2b和3)。有没有办法在raspberry pi 4上安装opencv?
发布于 2019-07-30 07:00:24
我有完全相同的问题,从周日开始,我的Raspberry Pi 3B和当前的Raspbian版本。
在Python2.7下,安装已经完成,但是图像中有噪声,这在以前没有发生过。
PS:由于SD卡问题,我不得不在周日完全重新安装Raspbian。
版本:
Raspbian Buster with desktop and recommended software
Image with desktop and recommended software based on Debian Buster
Version:July 2019
Release date:2019-07-10
Kernel version:4.19
Python 3.7.3
PIP 19.2.1安装了当前的numpy包。
发布于 2019-09-15 06:43:56
嘿,你可以用这个脚本在raspberry pi和buster版本的raspbian。
首先,要使用下面的代码,您必须创建opencv41.sh文件,并将此代码放入opencv41.sh文件中。把这个文件放在家里。*在终端中使用bashopencv41.sh运行。请记住,您应该先到主目录,然后打开终端,并把这个command.Let我知道它是否工作。
bash opencv41.sh
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install screen
sudo apt-get -y install htop
# substitute string1 for string2 globally
sudo sed -i 's/CONF_SWAPSIZE=100/CONF_SWAPSIZE=2048/g' /etc/dphys-swapfile
sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start
sudo sed -i '$a gpu_mem=128' /boot/config.txt
sudo apt-get -y install build-essential cmake pkg-config
sudo apt-get -y install libjpeg-dev libtiff-dev libjasper-dev libpng12-dev
sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get -y install libxvidcore-dev libx264-dev
sudo apt-get -y install libgtk2.0-dev libgtk-3-dev
sudo apt-get -y install libatlas-base-dev gfortran
sudo apt-get -y install python3-dev
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.1.0.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.1.0.zip
unzip opencv.zip
unzip opencv_contrib.zip
# yes you really need to rename the directories
mv opencv-4.1.0/ opencv
mv opencv_contrib-4.1.0/ opencv_contrib
# you have to make python3.6 env so it uses python3.6 for the build
mkdir -p .virtualenvs
python3 -m venv .virtualenvs/cv2_env
source .virtualenvs/cv2_env/bin/activate
# took a really long time
pip3 install numpy
cd ~/opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
-D ENABLE_NEON=ON \
-D ENABLE_VFPV3=ON \
-D BUILD_TESTS=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D BUILD_EXAMPLES=OFF ..
make -j4
sudo make install
sudo ldconfig
sudo apt-get update
cd ~/opencv/build/lib/python3
mkdir -p ~/lib/cv2
cp cv2.cpython-37m-arm-linux-gnueabihf.so ~/lib/cv2
ln -s ~/lib/cv2/cv2.cpython-37m-arm-linux-gnueabihf.so ~/.virtualenvs/cv2_env/lib/python3.7/site-packages/cv2.so
cd ~
# update /etc/dphys-swapfile to increase size
# set CONF_SWAPSIZE=100
# set CONF_SWAPSIZE=2048
sudo sed -i 's/CONF_SWAPSIZE=2048/CONF_SWAPSIZE=100/g' /etc/dphys-swapfile
sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start
# update /boot/config.txt
sudo sed -i 's/gpu_mem=128/gpu_mem=16/g' /boot/config.txt
rm opencv.zip
rm opencv_contrib.zip
sudo rm -r opencv
sudo rm -r opencv_contrib
# to test
# source ~/.virtualenvs/cv2_env/bin/activate
# python
# import cv2
# print(cv2.__version__)
# you should see 4.1.0https://stackoverflow.com/questions/57211068
复制相似问题