python - 在 linux 中导入 python 版本 3.7.4 中的 theano 库时出错
问题描述
您可以在此临时文件中找到 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..
解决方案
您需要python-dev
为正确的头文件安装扩展。对于 Debian 分发包python3-dev
,可以使用apt-get
. 对于 Redhat 发行版,它python3-devel
可能与它一起安装yum
我希望这能解决你的问题。
推荐阅读
- python-3.x - python 3制表符分隔文件添加列file.write
- opengl-es - 如何获得 GPU 渲染时间的等效 CPU 时差
- ios - ios 应用审核通过时如何获得通知?
- kafka-consumer-api - 我们如何使用 Spring Cloud Stream 启用日志压缩?
- javascript - 在加载 JSON 之前阻止 javascript 函数执行
- javascript - 如何确保所有使用redux的promise中的promise顺序正确?
- python-3.x - 在 TensorFlow 中训练“BoostedTreesClassifier”?
- android - Android 从设备内部存储器显示 webview 内容
- r - get an element from a subset of a matrix in Rarmadillo
- python - 在 biopython 中使用 pairwise2 匹配的残基索引