本文主要是介绍pip安装django-iprestrict[geoip] 报错:error: command 'x86_64-linux-gnu-gcc' failed with exit status 1,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
使用pip安装django-iprestrict[geoip]:
➜ ~ sudo pip3 install django-iprestrict\[geoip\]
...此处省略好多行Running setup.py bdist_wheel for GeoIP ... errorComplete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ur8tctju/GeoIP/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp798t3yhtpip-wheel- --python-tag cp35:/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'bugtrack_url'warnings.warn(msg)running bdist_wheelrunning buildrunning build_extbuilding 'GeoIP' extensioncreating buildcreating build/temp.linux-x86_64-3.5x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c py_GeoIP.c -o build/temp.linux-x86_64-3.5/py_GeoIP.opy_GeoIP.c:23:19: fatal error: GeoIP.h: 没有那个文件或目录compilation terminated.error: command 'x86_64-linux-gnu-gcc' failed with exit status 1----------------------------------------Failed building wheel for GeoIPRunning setup.py clean for GeoIPRunning setup.py bdist_wheel for maxminddb ... doneStored in directory: /home/lss/.cache/pip/wheels/15/76/41/255dfba221c2556c5e45dcf0d832ee63ea83dd151dada50b0f
Successfully built django-templatetag-handlebars pycountry maxminddb
Failed to build GeoIP
Installing collected packages: pytz, Django, django-templatetag-handlebars, pycountry, GeoIP, maxminddb, certifi, urllib3, idna, chardet, requests, geoip2, django-iprestrictRunning setup.py install for GeoIP ... errorComplete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ur8tctju/GeoIP/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-z4edljlo-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'bugtrack_url'warnings.warn(msg)running installrunning buildrunning build_extbuilding 'GeoIP' extensioncreating buildcreating build/temp.linux-x86_64-3.5x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c py_GeoIP.c -o build/temp.linux-x86_64-3.5/py_GeoIP.opy_GeoIP.c:23:19: fatal error: GeoIP.h: 没有那个文件或目录compilation terminated.error: command 'x86_64-linux-gnu-gcc' failed with exit status 1----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ur8tctju/GeoIP/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-z4edljlo-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-ur8tctju/GeoIP/
看报错信息发现应该是GeoIP这个包的问题,单独运行:
➜ ~ sudo pip3 install GeoIP
The directory '/home/lss/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/lss/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting GeoIPDownloading https://files.pythonhosted.org/packages/f2/7b/a463b7c3df8ef4b9c92906da29ddc9e464d4045f00c475ad31cdb9a97aae/GeoIP-1.3.2.tar.gz
Installing collected packages: GeoIPRunning setup.py install for GeoIP ... errorComplete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-o6bh_yap/GeoIP/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-1ryyzr40-record/install-record.txt --single-version-externally-managed --compile:/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'bugtrack_url'warnings.warn(msg)running installrunning buildrunning build_extbuilding 'GeoIP' extensioncreating buildcreating build/temp.linux-x86_64-3.5x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c py_GeoIP.c -o build/temp.linux-x86_64-3.5/py_GeoIP.opy_GeoIP.c:23:19: fatal error: GeoIP.h: 没有那个文件或目录compilation terminated.error: command 'x86_64-linux-gnu-gcc' failed with exit status 1----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-o6bh_yap/GeoIP/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-1ryyzr40-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-o6bh_yap/GeoIP/
果然报错,网上搜索类似好多这个报错信息的问题发现应该是缺少某个依赖包,不过还没有找到应该是什么包…
未完待续…
这篇关于pip安装django-iprestrict[geoip] 报错:error: command 'x86_64-linux-gnu-gcc' failed with exit status 1的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!