简体   繁体   English

Cython 编译器 - 致命错误 C1083:无法打开包含文件

[英]Cython compiler - fatal error C1083: Cannot open include file

I followed the following steps to replicate the Classical Music Composition Using State Space Models code.我按照以下步骤复制了使用状态空间模型的古典音乐创作代码。

The inference algorithms for this code are in Cython.此代码的推理算法在 Cython 中。 To run the notebook, first run:要运行笔记本,首先运行:

np.get_include() , which will output a sample-path. np.get_include() ,它将输出一个样本路径。

Then, in the terminal set export CFLAGS="-I sample-path $CFLAGS" .然后,在终端设置export CFLAGS="-I sample-path $CFLAGS" I used Windows equivalent:我使用了 Windows 等效项:

set CFLAGS = "-IC:\\Users\\scvan\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\numpy\\core\\include%CFLAGS%"

Finally, in the terminal, run最后,在终端中,运行

python setup.py build_ext --inplace

However, when I try to run the build_ext command I keep getting the following error:但是,当我尝试运行 build_ext 命令时,我不断收到以下错误:

building 'BaumWelch' extension
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\Include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /TcBaumWelch.c /Fobuild\temp.win-amd64-cpython-310\Release\BaumWelch.obj
BaumWelch.c
BaumWelch.c(711): fatal error C1083: Cannot open include file: 'numpy/arrayobject.h': No such file or directory
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2

To my knowledge, I have installed all the correct build tools in Visual Studio.据我所知,我已经在 Visual Studio 中安装了所有正确的构建工具。 Maybe I have used the wrong Windows equivalent for expor CFLAGS, can anybody help me out?也许我为 expor CFLAGS 使用了错误的 Windows 等效项,有人可以帮我吗?

I fixed the problem by adding include_dirs = [numpy.get_include()] to the setup.py file:我通过将include_dirs = [numpy.get_include()]添加到setup.py文件来解决问题:

from distutils.core import setup
from Cython.Build import cythonize
import numpy

setup(
 name = 'Baum Welch Code',
 ext_modules = cythonize("BaumWelch.pyx"),
 include_dirs = [numpy.get_include()]
)

暂无
暂无

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

相关问题 编译Cython代码产生...致命错误C1083:无法打开包含文件:'io.h' - Compiling Cython code yields… fatal error C1083: Cannot open include file: 'io.h' SWIG致命错误C1083:无法打开包含文件 - SWIG Fatal error C1083: Cannot open include file 在 Windows x64 中运行 Cython - 致命错误 C1083:无法打开包含文件:'basetsd.h':没有这样的文件或目录 - Running Cython in Windows x64 - fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory 致命错误C1083:无法打开包含文件:'openssl / opensslv.h':没有这样的文件或目录 - fatal error C1083: Cannot open include file: 'openssl/opensslv.h': No such file or directory 致命错误 C1083:无法打开包含文件:'dlfcn.h':没有这样的文件或目录 PyLPSolve - fatal error C1083: Cannot open include file: 'dlfcn.h': No such file or directory PyLPSolve 致命错误 C1083:无法打开包含文件:“mecab.h”:没有这样的文件或目录 - fatal error C1083: Cannot open include file: 'mecab.h': No such file or directory 致命错误 C1083:无法打开包含文件:'io.h':没有这样的文件或目录 - fatal error C1083: Cannot open include file: 'io.h': No such file or directory 致命错误 C1083:无法打开包含文件:“basetsd.h” - fatal error C1083: Cannot open include file: 'basetsd.h' 致命错误 C1083:无法打开包含文件:'openssl/opensslv.h' - Fatal error C1083: Cannot open include file: 'openssl/opensslv.h' Tokyocabinet致命错误C1083:无法打开包含文件:tcbdb.h - Tokyocabinet fatal error C1083 : cannot open include file:tcbdb.h
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM