简体   繁体   中英

Error in installing pymssql 1.0.2 on Windows 2003 x64

I am trying to install the latest version of pymssql (1.0.2) in my Windows 2003 x64. However, I am constantly getting this error:

running install
running build
running build_py
running build_ext
building '_mssql' extension
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG "-Ic:\Program Files\Microsoft SQL Server\80\Tool
s\DevTools\Include" -Ic:\mssql7\DevTools\Include -Id:\DEVEL\pymssql-DEVTOOLS\INCLUDE -Ic:\Python27\include -Ic:\Python27\PC /Tcmssqldbmodule.c /Fobuil
d\temp.win32-2.7\Release\mssqldbmodule.obj
mssqldbmodule.c
mssqldbmodule.c(50) : fatal error C1083: Cannot open include file: 'sqlfront.h': No such file or directory
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2

Any ideas? Isn't sqlfront.h included in the installation of visual studio 2k8 (or any visual studios)

Thank you!

I had the same problem with Visual Studio 2008, Windows 7 64 and Python 2.7 (32 bits).

These were the steps I followed to solved it:

  1. Install Visual Studio 2008 (32 bits).
  2. Install Visual Studio 6.
  3. Install Python 2.7 (32 bits)
  4. Download pymssql (the same package you downloaded)
  5. Try to compile the source code (the same you did when you got the error, you will get it again).
  6. At the same directory where setup.py is, you should find a file named mssqldbmodule.c , open it.
  7. Change the lines #include <sqlfront.h> and #include <sqldb.h> To #include "sqlfront.h" and #include "sqldb.h" So the compiler will look for sqlfront.h and sqldb.h files locally.
  8. Copy the files sqlfront.h and sqldb.h from: C:\\Program Files (x86)\\Microsoft Visual Studio\\VC98\\Include (Visual Studio 6 installation) To you local directory (where setup.py is).
  9. Copy the file NTWDBLIB.LIB from C:\\Program Files (x86)\\Microsoft Visual Studio\\VC98\\Lib To your local directory.
  10. Run again setup.py install

This way you will compile the library using the deprecated NTWDBLIB which is the one used by pymssql.

The directory <pymssql root>\\freetds\\vs2008_32\\ (or <pymssql root>\\freetds\\vs2008_64\\ if you use 64bits python) has not been set for header files and libs yet I think.

About freetds, please check the "Building FreeTDS" part of README_building_and_developing.rst.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM