Problems encountered in the early stages of OpenCV learning
ImportError: DLL load failed while importing mtrand: The specified program could not be found.
After reinstalling python, I still couldn’t use it, and then I found out many times that the problem was caused by the wrong version of python.
After trying python 3.9, python 3.6, python 3.8 and a series of other versions, I found that the same problem was still reported.
"E:\specialize software\Python3.9\python.exe" E:/Workspace/untitled1/venv/openvtest.py
OpenCV bindings requires "numpy" package.
Install it via command:
pip install numpy
Traceback (most recent call last):
File "E:\Workspace\untitled1\venv\openvtest.py", line 1, in <module>
import cv2
File "C:\Users\Administrator\AppData\Roaming\Python\Python39\site-packages\cv2\__init__.py", line 11, in <module>
import numpy
File "C:\Users\Administrator\AppData\Roaming\Python\Python39\site-packages\numpy\__init__.py", line 161, in <module>
from . import random
File "C:\Users\Administrator\AppData\Roaming\Python\Python39\site-packages\numpy\random\__init__.py", line 180, in <module>
from . import _pickle
File "C:\Users\Administrator\AppData\Roaming\Python\Python39\site-packages\numpy\random\_pickle.py", line 1, in <module>
from .mtrand import RandomState
ImportError: DLL load failed while importing mtrand: The specified program could not be found.
After a series of attempts, it is finally found that Anaconda 3-5.3.1 can adapt to opencv Python and numpy packages. If the problem appears, this error indicates that opencv Python and numpy have been PIP before, so I won’t repeat here. The installation methods of CV2 and numpy are everywhere. If not, please ask Du Niang.
The following is the image download website of Anaconda 3-5.3.1
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
After downloading, you can install it directly. Be careful not to install it on disk C
No error is reported after importing CV2 and numpy again using anaconda
import numpy
import cv2
if __name__ == '__main__':
print('Success')
"E:\specialize software\Anaconda\python.exe" E:/Workspace/untitled1/venv/openvtest.py Success Process has ended, exit code 0
Similar Posts:
- [Solved] Tensorflow:ImportError: DLL load failed: The specified module cannot be found Failed to load the native TensorFlow runtime
- [Solved] “import numpy as np” ImportError: No module named numpy
- import win32api; Importerror: DLL load failed: the specified program was not found
- Pycharm introduces numpy error: ImportError: Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy.
- [Solved] Exception: Jupyter command `jupyter-notbook` not found.
- [Solved] SQLAlchemy Error: ImportError: cannot import name ‘TYPE_CHECKING’
- [Solved] Python 3.8 Install pyaudio Error: pip3 install pyaudio error: Microsoft Visual C++ 14.0 or greater is required.
- Tensorflow ImportError: DLL load failed with error code -1073741795
- [Solved] peewee error: ImportError: No module named ‘MySQLdb’;pymysql error: from . import connections # noqa: E402
- TypeError at /index.html/ ‘method’ object is not subscriptable