我在 Windows 7 64 位上运行 Anaconda 4.3.1 (Python 3.6.1) 并且无法将 theano 和 openturns 都导入到我的会话中,但是只导入一个或另一个可以正常工作。显然,一个在另一个中引起了某种导入冲突,但我对导入过程的了解还不够,无法确定原因。
如果 theano 被导入并且我尝试导入 openturns,我会得到这个:
import theano.tensor as tt
import openturns as ot
Traceback (most recent call last):
File "<ipython-input-38-704e69d30dff>", line 1, in <module>
import openturns as ot
File "C:\Anaconda3\lib\site-packages\openturns\__init__.py", line 61, in <module>
from .common import *
File "C:\Anaconda3\lib\site-packages\openturns\common.py", line 20, in <module>
_common = swig_import_helper()
File "C:\Anaconda3\lib\site-packages\openturns\common.py", line 19, in swig_import_helper
return importlib.import_module('_common')
File "C:\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_common'
如果我尝试相反,其中 openturns 被导入,然后我尝试导入 theano,我得到这个:
import openturns as ot
from theano import tensor as tt
Traceback (most recent call last):
File "<ipython-input-3-ed4283f52c57>", line 1, in <module>
from theano import tensor as tt
File "C:\Anaconda3\lib\site-packages\theano\__init__.py", line 80, in <module>
from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
File "C:\Anaconda3\lib\site-packages\theano\scan_module\__init__.py", line 41, in <module>
from theano.scan_module import scan_opt
File "C:\Anaconda3\lib\site-packages\theano\scan_module\scan_opt.py", line 60, in <module>
from theano import tensor, scalar
File "C:\Anaconda3\lib\site-packages\theano\tensor\__init__.py", line 9, in <module>
from theano.tensor.subtensor import *
File "C:\Anaconda3\lib\site-packages\theano\tensor\subtensor.py", line 26, in <module>
import theano.gof.cutils # needed to import cutils_ext
File "C:\Anaconda3\lib\site-packages\theano\gof\cutils.py", line 320, in <module>
compile_cutils()
File "C:\Anaconda3\lib\site-packages\theano\gof\cutils.py", line 285, in compile_cutils
preargs=args)
File "C:\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 2325, in compile_str
return dlimport(lib_filename)
File "C:\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 302, in dlimport
rval = __import__(module_name, {}, {}, [module_name])
ImportError: DLL load failed: The specified procedure could not be found.
不确定是否相关,但 Theano 安装要求我将包含一些 DLL 的文件夹添加到系统 PATH。谢谢!