取り急ぎメモ.
環境
インストール
libGeoIP-develが必要.
管理者権限でCygwinを起動して以下を実行.
$ apt-cyg install libGeoIP-develhash_check: sha512sum: GeoIP-database-20161207-1.tar.xz: OK Unpacking... Package GeoIP-database installed Package cygwin is already installed, skipping Package libGeoIP1 installed Package pkg-config is already installed, skipping Running postinstall scripts Package libGeoIP-devel installed$ pip install GeoIP Collecting GeoIP Using cached GeoIP-1.3.2.tar.gz Installing collected packages: GeoIP Running setup.py install for GeoIP ... done Successfully installed GeoIP-1.3.2</pre> <h3> 実行確認</h3> <pre class="theme:dark-terminal lang:default decode:true">$ python Python 2.7.10 (default, Jun 1 2015, 18:17:45) [GCC 4.9.2] on cygwin Type "help", "copyright", "credits" or "license" for more information. >>> import GepIP Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named GepIP >>> import GeoIP >>> gi = GeoIP.new(GeoIP.GEOIP_MEMORY_CACHE) >>> gi.country_code_by_name("yahoo.com") 'US' >>> gi.country_code_by_addr("107.189.171.198") 'US'</pre> <h4> 参考</h4> <ul> <li><a href="GeoIP">http://sonickun.hatenablog.com/entry/2014/07/30/211426">GeoIPでIPアドレスから位置情報を取得する[Python]</a></li> </ul>