在windows上安装GeoIPPython时出错

2024-05-29 03:25:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试在Windows7上安装GeoIP-Python-1.2.4。 在此之前,我需要安装GeoIP-1.4.6。 我正在使用自述文件.MinGW安装说明。我使用MinGW并通过了./configure。当我执行“make”操作时,会出现以下错误:

*** Warning: This system can not link to static lib archive libGeoIP.la.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have.
libtool: link: warning: undefined symbols not allowed in i686-pc-mingw32 shared
libraries
ar cru .libs/libGeoIPUpdate.a  GeoIPUpdate.o md5.o
ranlib .libs/libGeoIPUpdate.a
creating libGeoIPUpdate.la
(cd .libs && rm -f libGeoIPUpdate.la && cp -p ../libGeoIPUpdate.la libGeoIPUpdat
e.la)
make[1]: Leaving directory `/home/Harp/GeoIP-1.4.6/libGeoIP'
Making all in apps
make[1]: Entering directory `/home/Harp/GeoIP-1.4.6/apps'
gcc -DPACKAGE_NAME=\"GeoIP\" -DPACKAGE_TARNAME=\"GeoIP\" -DPACKAGE_VERSION=\"1.4
.6\" -DPACKAGE_STRING=\"GeoIP\ 1.4.6\" -DPACKAGE_BUGREPORT=\"support@maxmind.com
\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -
DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE
_STDINT_H=1 -DHAVE_UNISTD_H=1 -D__EXTENSIONS__=1 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1
 -D_POSIX_PTHREAD_SEMANTICS=1 -D_TANDEM_SOURCE=1 -DPACKAGE=\"GeoIP\" -DVERSION=\
"1.4.6\" -DLITTLE_ENDIAN_HOST=1 -DHAVE_STDINT_H=1 -DHAVE_ZLIB_H=1 -DHAVE_GETTIME
OFDAY=1 -DHAVE_VSNPRINTF=1 -DHAVE_VSPRINTF=1 -I. -I../libGeoIP -Wall -DSYSCONFDI
R=\"/usr/local/etc\" -Wall   -O3 -I/usr/local/include -c geoiplookup.c
/bin/sh ../libtool --tag=CC   --mode=link gcc  -O3 -I/usr/local/include  -L/usr/
local/lib -lwsock32 -o geoiplookup.exe geoiplookup.o ../libGeoIP/libGeoIP.la
mkdir .libs
gcc -O3 -I/usr/local/include -o geoiplookup.exe geoiplookup.o  -L/usr/local/lib
../libGeoIP/.libs/libGeoIP.a -lwsock32
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x8af): undefined reference
 to `getnameinfo'
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0xa1c): undefined reference
 to `getaddrinfo'
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0xa48): undefined reference
 to `freeaddrinfo'
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x14ae): undefined referenc
e to `getaddrinfo'
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x14e7): undefined referenc
e to `freeaddrinfo'
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x162c): undefined referenc
e to `getaddrinfo'
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x170f): undefined referenc
e to `freeaddrinfo'
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x2713): undefined referenc
e to `getaddrinfo'
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x281f): undefined referenc
e to `freeaddrinfo'
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x2ffb): undefined referenc
e to `getaddrinfo'
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x30bf): undefined referenc
e to `freeaddrinfo'
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x32b3): undefined referenc
e to `getaddrinfo'
../libGeoIP/.libs/libGeoIP.a(GeoIP.o):GeoIP.c:(.text+0x3377): undefined referenc
e to `freeaddrinfo'
collect2: ld returned 1 exit status
make[1]: *** [geoiplookup.exe] Error 1
make[1]: Leaving directory `/home/Harp/GeoIP-1.4.6/apps'
make: *** [all-recursive] Error 1

当我尝试安装GeoIP Python时,会出现以下错误:

^{pr2}$

我的目标是安装GeoIP Python。你知道我怎么做吗?或者有人能解释这些错误的含义吗?在

我试图寻找预建的选项,但没有找到任何。在


Tags: totextmakeusrlocallalibsgeoip
3条回答

在构建geoipclibrary时,我修改了它们在指令中给出的LDFLAGS,从而避免了链接器错误。我没有链接winsock32,而是链接了ws2\u32。使检查仍然失败,但只有在2个国家代码的名字测试。国家代码地址测试完成得很好。在

你可以试试

python setup.py build_ext -cmingw32

(或者-cmingw,不记得了。)

这样它将尝试使用MinGW编译器(从命令行可以看到,它默认为MSVC)

更好的选择:pygeoip,它是用于MaxMind GeoIP数据库的纯python API,不再需要C API了

相关问题 更多 >

    热门问题