如果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
>>>
知道发生什么事了吗?
2条答案
按热度按时间rkue9o1l1#
我遇到了和你一样的错误,我只是第二次执行
import opencv2
时修复了它。这是一个变通办法..但我可以继续工作,所以..guz6ccqo2#
我有同样的问题,但解决了。当我在jupyter笔记本上导入cv2时,同样的错误显示,但在那之后,我在终端(python)上导入了cv2,然后它工作了。最后,cv2可以导入到jupyter笔记本上。请尝试一下。