我想編譯/安裝IP2Location Python擴展在這裏找到:編譯IP2Location Python擴展爲Windows 7
www.ip2location.com/python.aspx
我試過下面的說明這些網站:
eli.thegreenplace.net/2008/06/28/compiling-python-extensions-with-distutils-and-mingw/ boodebr.org/main/python/build-windows-extensio ns
但是我沒有得到任何地方。問題是Python擴展依賴另一個C庫:
www.ip2location.com/c.aspx
當我嘗試編譯Cygwin中這個庫我得到以下輸出:
make all-recursive
make[1]: Entering directory `/home/ty/Python-IP2Location/C-IP2Location-3.0.0'
Making all in libIP2Location
make[2]: Entering directory `/home/ty/Python-IP2Location/C-IP2Location-3.0.0/li
bIP2Location'
/bin/sh ../libtool --tag=CC --mode=link gcc -mno-cygwin -IiMath/ -g -O2 -modul
e -no-undefined -avoid-version -o libIP2Location.la -rpath /cygdrive/c/MinGW/li
b libIP2Location_la-IP2Location.lo libIP2Location_la-imath.lo
libtool: link: rm -fr .libs/libIP2Location.dll.a
libtool: link: gcc -mno-cygwin -shared .libs/libIP2Location_la-IP2Location.o .l
ibs/libIP2Location_la-imath.o -mno-cygwin -o .libs/libIP2Location.dll -Wl,-
-enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libIP2Location.dll.
a
.libs/libIP2Location_la-IP2Location.o: In function `IP2Location_ip2no':
/home/ty/Python-IP2Location/C-IP2Location-3.0.0/libIP2Location/IP2Location.c:71
8: undefined reference to `[email protected]'
Creating library file: .libs/libIP2Location.dll.a
collect2: ld returned 1 exit status
make[2]: *** [libIP2Location.la] Error 1
make[2]: Leaving directory `/home/ty/Python-IP2Location/C-IP2Location-3.0.0/lib
IP2Location'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/ty/Python-IP2Location/C-IP2Location-3.0.0'
make: *** [all] Error 2
我在Windows 7 32位上運行python 2.6.3。 我有MS Visual Studio 2008(雖然不知道如何使用它),當然還有cygwin/MinGW。
任何幫助或指針將不勝感激。
因此,我得到了C庫來調用「C:\ Program Files \ Microsoft Visual Studio 9.0 \ VC \ vcvarsall.bat」+ nmake + Makefile.win + http://msinttypes.googlecode.com/ svn/trunk/stdint.h 現在擴展本身拒絕編譯:http://jckdnk111.pastebin.com/f71e8ff3d 有一點需要注意 - 「C:\ Python26 \ PCbuild」在我的機器上缺失。 – jckdnk111 2009-12-01 00:24:06