解決 If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or config
問題描述:
已經安裝了opencv的庫,
sudo pip3 install opencv-python(樹莓派)
但是呼叫時,cv2.****函式會報錯
eg:
cv2.imshow(“people_pic”, gray) # 顯示圖片
cv2.waitKey(5)
cv2.****函式會報錯
原因分析:
要保證openv-contrib-python的版本要大於等於opencv-python解決方案:
1.升級openv-contrib-python
如果你的opencv-python版本很高,升級openv-contrib-python也沒用!
pip install --upgrade pip
pip install opencv-contrib-python
2.降級opencv-python(下載指定版本)
個人覺得先升級openv-contrib-python,再降級opencv-python方便點
以下是樹莓派降級的方法:
(1)首先解除安裝了你下好的opencv的庫(具體操作自行百度)
(2)本人實測這版本好用opencv-3.4.3.18(個人覺得)
sudo pip3 install opencv-contrib-python==3.4.3.18
也許你下載到99%的時候就會報錯,這時候更換B計劃(換國內源)
sudo pip3 install opencv-contrib-python==3.4.3.18 -i http://mirrors.aliyun.com/pypi/simple
我就是報錯了N次,更換了國內源一次就成功了!!!
pip國內的一些映象
阿里雲: http://mirrors.aliyun.com/pypi/simple.
中國科技大學: https://pypi.mirrors.ustc.edu.cn/simple/ .
豆瓣: http://pypi.douban.com/simple/ .
清華大學: https://pypi.tuna.tsinghua.edu.cn/simple/ .
中國科學技術大學: http://pypi.mirrors.ustc.edu.cn/simple/.
修改源方法:
可以在使用pip的時候在後面加上-i引數,指定pip源
eg:
sudo pip3 install opencv-contrib-python -i http://mirrors.aliyun.com/pypi/simple
以上是本人實際應用中的問題記錄,如有錯誤,歡迎評論區指出
相關文章
- How to install sougoupinyin on Debian/Ubuntu.GoUbuntu
- pkg-config
- How to install (D)DoS Deflate on Debian 7 (Wheezy) / UbuntuUbuntu
- Linux命令pkg-configLinux
- go呼叫python報錯pkg-config: exec: "pkg-config": executable file not found in %PATH%GoPython
- 《CMake實踐》筆記二:INSTALL/CMAKE_INSTALL_PREFIX筆記
- 編譯ffmpeg遇到ERROR: x265 not found using pkg-config解決方法編譯Error
- pkg-config 在windows 上面的安裝。Windows
- fribidi not found using pkg-config
- ubuntu安裝CMakeUbuntu
- Package libxml-2.0 was not found in the pkg-config search pathPackageXML
- ERROR: freetype2 not found using pkg-configError
- before install octave package you must be install gcc-fortranPackageGC
- cmake編譯問題解決編譯
- Unity 解決 Because you are not a member of this projectUnityProject
- ubuntu install fontsUbuntu
- Install Chisel Tools on UbuntuUbuntu
- ubuntu for DP tools installUbuntu
- npm install 報錯解決NPM
- ubuntu adsl configUbuntu
- <摘錄>簡述configure、pkg-config、pkg_config_path三者的關係
- Ubuntu 18.04 install albertUbuntu
- Node JS Install - Ubuntu systemJSUbuntu
- Install qemu-arm for UbuntuUbuntu
- Debian 字型發虛解決記錄
- ubuntu apt-get install xxx報錯無法下載的解決方法Ubuntuapt-get
- brew install gcc 卡住解決方法GC
- npm install失敗解決方法NPM
- Python - Matplotlib and Numpy on Debian/UbuntuPythonUbuntu
- ubuntu安裝debian包的命令dpkg和apt的詳解UbuntuAPT
- MariaDB ubuntu install guideUbuntuGUIIDE
- Install erlang to Ubuntu 18.04 LTSUbuntu
- Install Rabbitmq to Ubuntu 18.04 LTSMQUbuntu
- Install Composer on Ubuntu 14.04Ubuntu
- Ubuntu install Atom via PPAUbuntu
- How to Install LibreOffice on UbuntuUbuntu
- CMake生成OpenCV解決方案&&編譯OpenCV原始碼OpenCV編譯原始碼
- npm install 失敗解決辦法NPM