【问题标题】:Visual Studio CL.exe cannot find python.hVisual Studio CL.exe 找不到 python.h
【发布时间】:2018-05-06 09:00:26
【问题描述】:

我正在尝试将这一行包含在我的 .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 在哪里?

【问题讨论】:

  • /LD?你确定吗?
  • 您要使用选项/? 并阅读吗?
  • 是的,我正在尝试编写一个 .DLL 供我的 python 调用。
  • 对不起,我应该这么说的。
  • 这可能也有帮助:msdn.microsoft.com/en-us/library/fwkeyyhe.aspx - 你仍然需要阅读它;-)

标签: python c visual-studio include-path


【解决方案1】:
cl /LD /I C:\python\include hello.c C:\python\libs\python36.lib

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-17
    • 2015-11-04
    • 2023-04-08
    • 1970-01-01
    • 2015-05-13
    • 1970-01-01
    • 1970-01-01
    • 2017-08-27
    相关资源
    最近更新 更多