OpenCV安装在Raspberry pi 3 B +

时间:2019-05-17 18:12:50

标签: python python-3.x opencv raspberry-pi raspberry-pi3

我已经安装了所有内容,并按照所有说明在Raspberry pi 3 B +中安装OpenCV。但是,当我尝试运行我的Python代码导入OpenCV时发生错误。

我的代码如下

import fire, hashlib
from eth_account import Account
import uuid, sys
import json
from web3 import Web3, HTTPProvider
import pyqrcode
from pathlib import Path
import os
from picamera import PiCamera
from time import sleep
from io import BytesIO
import pyzbar.pyzbar as pyzbar
import cv2
from guizero import App, Text, PushButton, Window, Picture, Box, info, yesno, error
from MyQR import myqr

发生以下错误

mportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
  File "/home/pi/Downloads/RPI-Wallet-Blue-master/wallet-with-ui.py", line 26, in <module>
    import cv2
  File "/usr/lib/python3/dist-packages/thonny/backend.py", line 305, in _custom_import
    module = self._original_import(*args, **kw)
  File "/home/pi/.local/lib/python3.5/site-packages/cv2/__init__.py", line 3, in <module>
    from .cv2 import *
  File "/usr/lib/python3/dist-packages/thonny/backend.py", line 305, in _custom_import
    module = self._original_import(*args, **kw)
ImportError: numpy.core.multiarray failed to import

注意:但是我的目标是导入CV2(OpenCV),为此,当我使用python2.7使用Raspberry pi Terminal时,导入时不会失败,但是当我使用Python3.5导入CV2(OpenCV)时,以下错误。

File "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python3.5/site-packages/cv2/__init__.py", line 3, in <module>
    from .cv2 import *
ImportError: numpy.core.multiarray failed to import

0 个答案:

没有答案