如何在python主机cpanel上使用OpenCV库?

2024-05-08 01:32:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个django项目,我需要在其中使用OpenCV库。只要我在计算机上的本地主机上运行项目,我就没有错误或问题。然而,当我在互联网上的真实主机(主机使用Linux作为操作系统)上推动我的项目时,我会遇到一些我无法解决的错误。在第一级,当Iimport cv2(我已经安装了numpy lib)时会显示此错误:

    OpenBLAS blas_thread_init: pthread_create failed for thread 30 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 31 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 32 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 33 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 34 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 35 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 36 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 37 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 38 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 39 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 40 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 41 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 42 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 43 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 44 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 45 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/camsclou/virtualenv/IP_Camera/3.5/lib/python3.5/site-packages/cv2/__init__.py", line 5, in <module>
    from .cv2 import *
ImportError: numpy.core.multiarray failed to import
Segmentation fault

因此,我假设我没有import numpy.core.multiarray是问题所在,但当我这样做时,新的错误出现了:

    OpenBLAS blas_thread_init: pthread_create failed for thread 30 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 31 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 32 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 33 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 34 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 35 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 36 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 37 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 38 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 39 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 40 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 41 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 42 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 43 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 44 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
OpenBLAS blas_thread_init: pthread_create failed for thread 45 of 46: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 35 current, 35 max
Traceback (most recent call last):
  File "/home/camsclou/virtualenv/IP_Camera/3.5/lib/python3.5/site-packages/numpy/core/__init__.py", line 24, in <module>
    from . import multiarray
  File "/home/camsclou/virtualenv/IP_Camera/3.5/lib/python3.5/site-packages/numpy/core/multiarray.py", line 14, in <module>
    from . import overrides
  File "/home/camsclou/virtualenv/IP_Camera/3.5/lib/python3.5/site-packages/numpy/core/overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: PyCapsule_Import could not import module "datetime"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/camsclou/virtualenv/IP_Camera/3.5/lib/python3.5/site-packages/numpy/__init__.py", line 142, in <module>
    from . import core
  File "/home/camsclou/virtualenv/IP_Camera/3.5/lib/python3.5/site-packages/numpy/core/__init__.py", line 50, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.5 from "/home/camsclou/virtualenv/IP_Camera/3.5/bin/python3.5_bin"
  * The NumPy version is: "1.18.5"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: PyCapsule_Import could not import module "datetime"

Segmentation fault

我已经在互联网上搜索了这个问题,我也查了错误页面,但我什么也没有得到。我应该如何在项目中使用此库


Tags: offorinitcreatecurrentthreadresourceblas