gpt4 book ai didi

Python 包导入冲突(Theano 和 openturns)

转载 作者:太空宇宙 更新时间:2023-11-03 15:08:46 27 4
gpt4 key购买 nike

我在 Windows 7 64 位上运行 Anaconda 4.3.1 (Python 3.6.1),无法将 theano 和 openturns 都导入到我的 session 中,但是仅导入其中之一就可以正常工作。显然,一个导致另一个发生某种导入冲突,但我对导入过程的了解不够,无法确定原因。

如果导入 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 的文件夹添加到系统路径中。谢谢!

最佳答案

似乎来自默认 anaconda channel 的 theano 包提取了 mingw 依赖项,这可能与我们自己提供的较新的运行时冲突;解决方法是安装 conda-forge 中的所有内容。

这应该有效:

conda install openturns theano pymc3 -c conda-forge

关于Python 包导入冲突(Theano 和 openturns),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44422100/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com