python安装及opencv-python和numpy安装问题

1. python版本:Python 3.10.0a2

opencv-python版本:4.5.5.64

2. 问题描述:安装完对应的opencv-python库后,安装numpy 1.22.4,提示如下:

C:\Users\yangm>python
Python 3.10.0a2 (tags/v3.10.0a2:114ee5d, Nov  3 2020, 00:37:42) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Users\yangm\AppData\Local\Programs\Python\Python310\lib\site-packages\cv2\__init__.py", line 8, in 
    from .cv2 import *
ImportError: numpy.core.multiarray failed to import

3. 尝试改进,降低numpy版本至1.19.5,安装中提示如下:

note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects

4.参考这篇帖子,Python3.10下安装Numpy失败 - 知乎 (zhihu.com)中说明numpy没有给python3.10提供编译好的wheel文件,按照帖子中的提示重装其他版本numpy为1.22.1版本,仍然提醒如下:

C:\Users\yangm>python
Python 3.10.0a2 (tags/v3.10.0a2:114ee5d, Nov  3 2020, 00:37:42) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Users\yangm\AppData\Local\Programs\Python\Python310\lib\site-packages\cv2\__init__.py", line 8, in 
    from .cv2 import *
ImportError: numpy.core.multiarray failed to import
>>>

你可能感兴趣的:(python)