0

env: python39 centos8 のみ

手順は次のとおりです。

[root@782c9d389ba6 /]# pip install opencv-python-headless
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting opencv-python-headless
  Using cached     https://pypi.tuna.tsinghua.edu.cn/packages/0b/5b/70685f60a3bfa5a3f74ba70faf3ebd43    5db4f778bc1610785cdacd793193/opencv_python_headless-4.4.0.46-cp39-cp39-    manylinux2014_x86_64.whl (36.7 MB)
Requirement already satisfied: numpy>=1.19.3 in     /usr/local/lib/python3.9/site-packages (from opencv-python-headless) (1.19.4)
Installing collected packages: opencv-python-headless
Successfully installed opencv-python-headless-4.4.0.46
[root@782c9d389ba6 ~]# python3
Python 3.9.0a6 (default, Jul 15 2020, 06:11:23) 
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/cv2/__init__.py", line 5, in <module>
  from .cv2 import *
  ImportError: /usr/local/lib/python3.9/site-packages/cv2/cv2.cpython-39-x86_64-linux-gnu.so: undefined symbol: PyCMethod_New
quit()
[root@782c9d389ba6 ~]# cd /usr/local/lib/python3.9/site-packages/cv2/
[root@782c9d389ba6 cv2]# ls
cv2.cpython-39-x86_64-linux-gnu.so data  __init__.py LICENSE-3RD-PARTY.txt  LICENSE.txt  __pycache__      version.py
[root@782c9d389ba6 cv2]# cat version.py 
opencv_version = "4.4.0.46"
contrib = True
headless = True
ci_build = True 

'''pip install opencv-python''' を試してみましたが、同じでした。環境によるものと思われますが、具体的な理由はわかりません。アドバイスをお願いします。ありがとうございました

4

0 に答える 0