opencv 导入错误:dlopen:无法加载更多具有静态TLS的对象

jogvjijk  于 2022-11-15  发布在  其他
关注(0)|答案(2)|浏览(370)

如果OpenCV(cv2)在tensorflow导出器之后导入,我会得到一个ImportError

ubuntu@ip-172-31-2-144:~/Downloads/opencv-2.4.13/release$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from tensorflow.contrib.session_bundle import exporter
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcurand.so locally
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen: cannot load any more object with static TLS
>>>

然而,反过来也可以:

ubuntu@ip-172-31-2-144:~/Downloads/opencv-2.4.13/release$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> from tensorflow.contrib.session_bundle import exporter
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcurand.so locally
>>>

知道发生什么事了吗?

rkue9o1l

rkue9o1l1#

我遇到了和你一样的错误,我只是第二次执行import opencv2时修复了它。这是一个变通办法..但我可以继续工作,所以..

guz6ccqo

guz6ccqo2#

我有同样的问题,但解决了。当我在jupyter笔记本上导入cv2时,同样的错误显示,但在那之后,我在终端(python)上导入了cv2,然后它工作了。最后,cv2可以导入到jupyter笔记本上。请尝试一下。

相关问题