编程语言
首页 > 编程语言> > LNK1104 无法打开文件“python37_d.lib”

LNK1104 无法打开文件“python37_d.lib”

作者:互联网

1. 找到python头文件pyconfig.h,将 # define Py_DEBUG 注释掉(330行)

330 #ifdef _DEBUG
331 #define Py_DEBUG // 将该行注释掉 332 #endif

 

2.找到以下代码(287行),将 pragma comment(lib,"python37_d.lib") 修改为 pragma comment(lib,"python37.lib") ,重新编译即可。

 278 /* For an MSVC DLL, we can nominate the .lib files used by extensions */
 279 #ifdef MS_COREDLL
 280 #       if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
 281                 /* not building the core - must be an ext */
 282 #               if defined(_MSC_VER)
 283                         /* So MSVC users need not specify the .lib
 284                         file in their Makefile (other compilers are
 285                         generally taken care of by distutils.) */
 286 #                       if defined(_DEBUG)
 287 #                               pragma comment(lib,"python37_d.lib")
 288 #                       elif defined(Py_LIMITED_API)
 289 #                               pragma comment(lib,"python3.lib")
 290 #                       else
 291 #                               pragma comment(lib,"python37.lib")
 292 #                       endif /* _DEBUG */
 293 #               endif /* _MSC_VER */
 294 #       endif /* Py_BUILD_CORE */
 295 #endif /* MS_COREDLL */

 

标签:comment,lib,defined,Py,LNK1104,python37,pragma
来源: https://www.cnblogs.com/chanyuantiandao/p/16671131.html