简体   繁体   English

在 linux 中的 python 版本 3.7.4 中导入 theano 库时出错

[英]Error importing theano library in python version 3.7.4 in linux

You can find the C code in this temporary file:您可以在此临时文件中找到 C 代码:

/tmp/theano_compilation_error_7_ntcw7n
Traceback (most recent call last):
  File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/gof/lazylinker_c.py", line 81, in <module>
    actual_version, force_compile, _need_reload))
ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/gof/lazylinker_c.py", line 105, in <module>
    actual_version, force_compile, _need_reload))
ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/__init__.py", line 110, in <module>
    from theano.compile import (
  File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/compile/__init__.py", line 12, in <module>
    from theano.compile.mode import *
  File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/compile/mode.py", line 11, in <module>
    import theano.gof.vm
  File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/gof/vm.py", line 674, in <module>
    from . import lazylinker_c
  File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/gof/lazylinker_c.py", line 140, in <module>
    preargs=args)
  File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/gof/cmodule.py", line 2396, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): /home/vaishnavnimkar/.theano/compiledir_Linux-5.2-2parrot1-amd64-x86_64-with-Parrot-4.7-stable--3.7.4+-64/lazylinker_ext/mod.cpp:1:10: fatal error: Python.h: No such file or directory.     1 | #include <Python.h>.       |          ^~~~~~~~~~. compilation terminated.. 

You need to install the python-dev extensions for proper header-files.您需要为正确的头文件安装python-dev扩展。 For Debian distributions package is python3-dev which can be installed with apt-get .对于 Debian 发行版,软件包是python3-dev ,可以使用apt-get安装。 For Redhat distributions its python3-devel which might be installed with yum对于 Redhat 发行版,它的python3-devel可能与yum一起安装

I hope this should solve your problem.我希望这可以解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM