python - Visual Studio CL.exe 找不到 python.h

标签 python c visual-studio include-path

我正在尝试将这一行包含在我的 .c 代码中

#include <Python.h>

我的 helloworld.c 中只有

#include <stdio.h>
#include <Python.h>

int main()
{
    printf("Hi, this is me. \n");
    system("pause");
    return 0;
}

我还没有写任何使用 python.h 的东西,因为我还不能 编译。这是我得到的错误:

fatal error C1083: Cannot open include file: 'Python.h': No such file or directory

我正在使用 CL.exe,visual studio 2017 的命令行编译器来运行它:

cl /LD helloworld.c

如何让编译器知道我的 python.h 在哪里?

最佳答案

cl /LD /I C:\python\include hello.c C:\python\libs\python36.lib

关于python - Visual Studio CL.exe 找不到 python.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50197984/

相关文章:

android - VS2017/Xamarin.Android : VS thinks it's still debugging after the emulator is closed

visual-studio - Visual Studio 测试工具与第三方工具的比较

python - Pygame 一段时间后无法从资源中读取

python - 在 Docker Pipenv 上安装 psycopg-binary 时,出现错误:在系统上找不到 Python 3.8

函数参数中的字符数组作为指针还是数组?

c - 请解释以下c程序的输出

c# - 从命令行生成 EF 存储过程方法

python - Tensorflow softmax_cross...()函数float类型错误

python - Perl 6 是否具有与 Python 的 bytearray 方法等效的方法?

c++ - 指针指向 0x1 - 检查 null 是否有效?