2014-09-21 30 views
14

tôi cố gắng cài đặt geoip trong ubuntu trong python pip ... nhưng có cùng một lỗi gccpip geoip cài đặt do lỗi ubuntu gcc

pip install GeoIP 

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes - fPIC -I/usr/include/python2.7 -c py_GeoIP.c -o build/temp.linux-i686-2.7/py_GeoIP.o -fno- strict-aliasing 

py_GeoIP.c:23:19: fatal error: GeoIP.h: No such file or directory 

compilation terminated. 

error: command 'gcc' failed with exit status 1 

làm thế nào để giải quyết vấn đề này trong ubuntu

+1

Từ trang ['GeoIP' PyPi] (https://pypi.python.org/pypi/GeoIP/): ** Yêu cầu **: * Thư viện GeoIP C 1.4.7 hoặc cao hơn *. Bạn đã cài đặt thư viện C chưa? –

Trả lời

33

Bạn cần để cài đặt gói libgeoip-dev.

$ easy_install GeoIP 
Searching for GeoIP 
Reading https://pypi.python.org/simple/GeoIP/ 
... 
py_GeoIP.c:23:19: fatal error: GeoIP.h: No such file or directory 
#include "GeoIP.h" 
       ^
compilation terminated. 
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 
Returned 1. 


$ apt-cache search geoip 
... 
libgeoip-dev - Development files for the GeoIP library 
... 


[email protected]:~$ sudo apt-get install libgeoip-dev -y 
[sudo] password for andrew: 
Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
The following NEW packages will be installed: 
    geoip-bin libgeoip-dev 
0 upgraded, 2 newly installed, 0 to remove and 159 not upgraded. 
... 
Setting up libgeoip-dev (1.5.1-1ubuntu1) ... 
[email protected]:~$ easy_install GeoIP 
... 
Running GeoIP-1.3.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-rwdpkL/GeoIP-1.3.2/egg-dist-tmp-DLLeBT 
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url' 
    warnings.warn(msg) 
warning: no files found matching 'ChangeLog' 
zip_safe flag not set; analyzing archive contents... 
Adding GeoIP 1.3.2 to easy-install.pth file 

Installed /home/andrew/.local/lib/python2.7/site-packages/GeoIP-1.3.2-py2.7-linux-x86_64.egg 
Processing dependencies for GeoIP 
Finished processing dependencies for GeoIP 

Nếu bạn cài đặt gói apt-file, bạn cũng có thể tìm kiếm theo tên tập tin cho những đóng gói chứa tập tin đó:

$ apt-file search GeoIP.h 
libgeoip-dev: /usr/include/GeoIP.h 

Điều này thực sự tiện dụng cho bất kỳ quá trình cài đặt/biên soạn mà không do phụ thuộc mất tích.

+0

cảm ơn nó là công việc –

+5

cảm ơn bạn đã giải quyết bằng 'sudo apt-get install libgeoip-dev -y' –

Các vấn đề liên quan