编程语言
首页 > 编程语言> > python – Theano步骤给错误的格式文件错误

python – Theano步骤给错误的格式文件错误

作者:互联网

我试图复制这个例子
Getting Started PyMC3.

在Windows 2012 R2上.

这一步
来自pymc3 import Model,Normal,HalfNormal

D:\Anaconda3\libs/python35.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status

    ---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
D:\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py in <module>()
     64         if version != getattr(lazylinker_ext, '_version', None):
---> 65             raise ImportError()
     66 except ImportError:

ImportError: 

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
D:\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py in <module>()
     81             if version != getattr(lazylinker_ext, '_version', None):
---> 82                 raise ImportError()
     83         except ImportError:

ImportError: 

During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
<ipython-input-4-582c90a634a6> in <module>()
----> 1 from pymc3 import Model, Normal, HalfNormal

D:\Anaconda3\lib\site-packages\pymc3\__init__.py in <module>()
      1 __version__ = "3.0"
      2 
----> 3 from .core import *
      4 from .distributions import *
      5 from .math import *

D:\Anaconda3\lib\site-packages\pymc3\core.py in <module>()
      1 from .vartypes import *
----> 2 from .model import *
      3 from .theanof import *
      4 from .blocking import *
      5 import numpy as np

D:\Anaconda3\lib\site-packages\pymc3\model.py in <module>()
      1 from .vartypes import *
      2 
----> 3 from theano import theano, tensor as t, function
      4 from theano.tensor.var import TensorVariable
      5 

D:\Anaconda3\lib\site-packages\theano\__init__.py in <module>()
     53     object2, utils
     54 
---> 55 from theano.compile import \
     56     SymbolicInput, In, \
     57     SymbolicOutput, Out, \

D:\Anaconda3\lib\site-packages\theano\compile\__init__.py in <module>()
      7         SpecifyShape, specify_shape, register_specify_shape_c_code)
      8 
----> 9 from theano.compile.function_module import *
     10 
     11 from theano.compile.mode import *

D:\Anaconda3\lib\site-packages\theano\compile\function_module.py in <module>()
     16 from theano import gof
     17 from theano.compat.python2x import partial
---> 18 import theano.compile.mode
     19 from theano.compile.io import (
     20     In, SymbolicInput, SymbolicInputKit, SymbolicOutput)

D:\Anaconda3\lib\site-packages\theano\compile\mode.py in <module>()
      9 import  theano
     10 from theano import gof
---> 11 import theano.gof.vm
     12 from theano.configparser import config, AddConfigVar, StrParam
     13 from theano.compile.ops import register_view_op_c_code, _output_guard

D:\Anaconda3\lib\site-packages\theano\gof\vm.py in <module>()
    566 
    567 try:
--> 568     from . import lazylinker_c
    569 
    570     class CVM(lazylinker_c.CLazyLinker, VM):

D:\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py in <module>()
    115             args = cmodule.GCC_compiler.compile_args()
    116             cmodule.GCC_compiler.compile_str(dirname, code, location=loc,
--> 117                                              preargs=args)
    118             # Save version into the __init__.py file.
    119             init_py = os.path.join(loc, '__init__.py')

D:\Anaconda3\lib\site-packages\theano\gof\cmodule.py in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module)
   2008             # difficult to read.
   2009             raise Exception('Compilation failed (return status=%s): %s' %
-> 2010                             (status, compile_stderr.replace('\n', '. ')))
   2011         elif config.cmodule.compilation_warning and compile_stderr:
   2012             # Print errors just below the command line.

我有gcc

C:\>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/TDM-GCC-64/bin/../libexec/gcc/x86_64-w64-mingw32/5.1.0/lt
o-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-5.1.0/configure --build=x86_64-w64-mingw32 --e
nable-targets=all --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable
-libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC -
-disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-libstdcxx-d
ebug --enable-threads=posix --enable-version-specific-runtime-libs --enable-full
y-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-l
d --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm -
-with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://td
m-gcc.tdragon.net/bugs
Thread model: posix
gcc version 5.1.0 (tdm64-1)

我错过了什么?

谢谢

解决方法:

无论是什么问题都在创建一个python 3.4环境

conda install mingw libpython

解决了它.

标签:python,gcc,theano,pymc3
来源: https://codeday.me/bug/20190824/1707173.html