Найти - Пользователи
Полная версия: SWIG pythonxy_d.lib cannot be found
Начало » Python для новичков » SWIG pythonxy_d.lib cannot be found
1
Yurietc
Здравствуйте.
Начал разбираться со SWIG, Visual Studio 2008, C++, Python 2.6, Windows 7. При билде проекта получаю ошибку python26_d.lib cannot be found. И действительно, такого файла нет в сборке питона. Есть описанное решение :
'''
This file is only used for Debug builds and is not included in the Python binary distribution. You must download the Python sources and build the LIB and the corresponding DLL yourself.

But be careful! When you link your extension module with the debug version of the Python interpreter, you can only import the module when python.exe is also a debug version. Otherwise, you will receive the error “Fatal Python error: Interpreter not initialized (version mismatch?).”
'''
Но проблемма в том, что код должен компилироваться на нескольких машинах. И делать сборку питона на каждой не представляется возможным. Посоветуйте как решить, что почитать.
Yurietc
Только-что нашел еще одно решение http://tutorial.debashis.net/?p=57
В принципе до него можно было и самому додуматься, но это же не кошерно …
Андрей Светлов
Кошерное решение:
#ifdef _DEBUG
#define RESTORE_DEBUG_FLAG
#undef _DEBUG
#endif
#include <python.h>
#ifdef RESTORE_DEBUG_FLAG
#define _DEBUG
#endif
SWIG — наверное, самое неудачное решение из всех возможных.
Yurietc
Хитро, но к сожалению Visual Studio тоже не пальцем деланная. Выдает ошибку

fatal error C1189: #error : You have included some C++/C library header files with _DEBUG defined and some with _DEBUG not defined. This will not work correctly. Please have _DEBUG set or clear consistently.

P.S. А как лучше вызывать С-шные модули питоном ?
Андрей Светлов
boost::python. Заодно в boost/python/details/wrap_python.hpp посмотрите, как именно это делается. Вроде бы для VC нужно кучу файлов сначала включить.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB