前提・実現したいこと
Django-herokuをLubuntu20.04にインストールしたいのですが
terminal
1pip install django-heroku
を実行すると以下のエラーが発生してインストールに失敗します。
発生している問題・エラーメッセージ
(python37) kalon@kalon-20ara19vjp:~/Dropbox/!Django/myproject$ pip install django-heroku Collecting django-heroku Using cached django_heroku-0.3.1-py2.py3-none-any.whl (6.2 kB) Requirement already satisfied: django in ./python37/lib/python3.7/site-packages (from django-heroku) (3.0.8) Requirement already satisfied: whitenoise in ./python37/lib/python3.7/site-packages (from django-heroku) (3.3.1) Requirement already satisfied: dj-database-url>=0.5.0 in ./python37/lib/python3.7/site-packages (from django-heroku) (0.5.0) Collecting psycopg2 Using cached psycopg2-2.8.5.tar.gz (380 kB) Requirement already satisfied: sqlparse>=0.2.2 in ./python37/lib/python3.7/site-packages (from django->django-heroku) (0.3.1) Requirement already satisfied: pytz in ./python37/lib/python3.7/site-packages (from django->django-heroku) (2020.1) Requirement already satisfied: asgiref~=3.2 in ./python37/lib/python3.7/site-packages (from django->django-heroku) (3.2.10) Using legacy 'setup.py install' for psycopg2, since package 'wheel' is not installed. Installing collected packages: psycopg2, django-heroku Running setup.py install for psycopg2 ... error ERROR: Command errored out with exit status 1: command: '/home/kalon/Dropbox/!Django/myproject/python37/bin/python' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-swzub0k7/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-swzub0k7/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-votth3rx/install-record.txt --single-version-externally-managed --compile --install-headers '/home/kalon/Dropbox/!Django/myproject/python37/include/site/python3.7/psycopg2' cwd: /tmp/pip-install-swzub0k7/psycopg2/ Complete output (40 lines): running install running build running build_py creating build creating build/lib.linux-x86_64-3.7 creating build/lib.linux-x86_64-3.7/psycopg2 copying lib/compat.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/errors.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/_json.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/tz.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/extensions.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/__init__.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/_range.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/extras.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/sql.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/errorcodes.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/pool.py -> build/lib.linux-x86_64-3.7/psycopg2 running build_ext building 'psycopg2._psycopg' extension creating build/temp.linux-x86_64-3.7 creating build/temp.linux-x86_64-3.7/psycopg x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fdebug-prefix-map=/build/python3.7-04P6eK/python3.7-3.7.8=. -fstack-protector-strong -Wformat -Werror=format-security -g -fdebug-prefix-map=/build/python3.7-04P6eK/python3.7-3.7.8=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_VERSION=2.8.5 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120002 -DHAVE_LO64=1 -I/home/kalon/Dropbox/!Django/myproject/python37/include -I/usr/include/python3.7m -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement In file included from psycopg/psycopgmodule.c:28: ./psycopg/psycopg.h:35:10: fatal error: Python.h: そのようなファイルやディレクトリはありません 35 | #include <Python.h> | ^~~~~~~~~~ compilation terminated. It appears you are missing some prerequisite to build the package from source. You may install a binary package by installing 'psycopg2-binary' from PyPI. If you want to install psycopg2 from source, please install the packages required for the build and try again. For further information please check the 'doc/src/install.rst' file (also at <https://www.psycopg.org/docs/install.html>). error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- ERROR: Command errored out with exit status 1: '/home/kalon/Dropbox/!Django/myproject/python37/bin/python' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-swzub0k7/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-swzub0k7/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-votth3rx/install-record.txt --single-version-externally-managed --compile --install-headers '/home/kalon/Dropbox/!Django/myproject/python37/include/site/python3.7/psycopg2' Check the logs for full command output.
試したこと
sudo apt install libpq-dev
pip install psycopg2
sudo apt install libpq-dev python3-dev
pip install psycopg2-binary
pip install postgresql-devel
補足情報(FW/ツールのバージョンなど)
Django3.0.8
Python3.7.8
アドバイスとご教授をよろしくおねがいします。
あなたの回答
tips
プレビュー