gpt4 book ai didi

python - OpenCV 安装成功但 ImportError : No module named 'cv2'

转载 作者:太空宇宙 更新时间:2023-11-03 21:51:49 25 4
gpt4 key购买 nike

所以我已经在 Ubuntu 14.04 上从源代码成功安装了 OpenCV 3.2.0 并且我收到了这个错误:

(cv2) mona@pascal:~/computer_vision/opencv-3.2.0/build$  /usr/local/bin/opencv_version
3.2.0
(cv2) mona@pascal:~/computer_vision/opencv-3.2.0/build$ python
Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'cv2'
>>> import cv
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'cv'

在我可能错过的 sudo make install 步骤之后我应该做什么?

不幸的是这里也没有 cv2:

mona@pascal:~/computer_vision/opencv-3.2.0/build$ ls /usr/local/lib/python3.4/dist-packages/
clonevirtualenv.py numpy protobuf-3.1.0.post1.dist-info stevedore virtualenvwrapper
django numpy-1.12.0.egg-info protobuf-3.1.0.post1-py2.7-nspkg.pth stevedore-1.20.0.dist-info virtualenvwrapper-4.7.2-py3.4.egg-info
Django-1.10.5.dist-info olefile __pycache__ tensorflow virtualenvwrapper-4.7.2-py3.4-nspkg.pth
easy_install.py olefile-0.44-py3.4.egg-info PyYAML-3.12-py3.4.egg-info tensorflow_gpu-0.12.1.dist-info wheel
external OleFileIO_PL.py scipy theano wheel-0.29.0.dist-info
google pbr scipy-0.18.1-py3.4.egg-info Theano-0.8.2-py3.4.egg-info yaml
image pbr-1.10.0.dist-info setuptools virtualenv-15.1.0.dist-info
image-1.5.5-py3.4.egg-info PIL setuptools-33.1.1.dist-info virtualenv_clone-0.2.6-py3.4.egg-info
keras Pillow-4.0.0-py3.4.egg-info six-1.10.0.dist-info virtualenv.py
Keras-1.2.0-py3.4.egg-info pkg_resources six.py virtualenv_support

最佳答案

按照本指南在 Raspberry Pi 3 上安装 openCV 时,我遇到了同样的问题: http://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/

问题是 cv2.so 文件安装在“/usr/local/lib/python2.7/dist-packages/”而不是“/usr/local/lib/python2.7/site-packages/” .

我的解决方案是简单地使用以下命令复制文件:“sudo cp/usr/local/lib/python2.7/dist-packages/cv2.so/usr/local/lib/python2.7/site-packages/cv2.so”

希望这对您有所帮助。

关于python - OpenCV 安装成功但 ImportError : No module named 'cv2' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41733557/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com