python - 使用 pipenv 安装 django-heroku 时出错
问题描述
在这里对 Django 来说很新。不确定问题。
- 基本操作系统 0.4.1 洛基
- django 2.1
- django-rest-framework 3.8.2
- 独角兽
- 蟒蛇3.7
所以我在我的pipenv shell
运行pipenv install django-heroku
。我得到了这个疯狂的错误:
An error occurred while installing psycopg2==2.8.2 --hash=sha256:00cfecb3f3db6eb76dcc763e71777da56d12b6d61db6a2c6ccbbb0bff5421f8f --hash=sha256:076501fc24ae13b2609ba2303d88d4db79072562f0b8cc87ec1667dedff99dc1 --hash=sha256:4e2b34e4c0ddfeddf770d7df93e269700b080a4d2ec514fec668d71895f56782 --hash=sha256:5cacf21b6f813c239f100ef78a4132056f93a5940219ec25d2ef833cbeb05588 --hash=sha256:61f58e9ecb9e4dc7e30be56b562f8fc10ae3addcfcef51b588eed10a5a66100d --hash=sha256:8954ff6e47247bdd134db602fcadfc21662835bd92ce0760f3842eacfeb6e0f3 --hash=sha256:b6e8c854cdc623028e558a409b06ea2f16d13438335941c7765d0a42b5bedd33 --hash=sha256:baca21c0f7344576346e260454d0007313ccca8c170684707a63946b27a56c8f --hash=sha256:bb1735378770fb95dbe392d29e71405d45c8bdcfa064f916504833a92ab03c55 --hash=sha256:de3d3c46c1ee18f996db42d1eb44cf1565cc9e38fb1dbd9b773ff6b3fa8035d7 --hash=sha256:dee885602bb200bdcb1d30f6da6c7bb207360bc786d0a364fe1540dd14af0bab! Will try again.
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 8/8 — 00:00:04
Installing initially failed dependencies…
[pipenv.exceptions.InstallError]: File "/home/andrew/.local/lib/python3.5/site-packages/pipenv/core.py", line 1874, in do_install
[pipenv.exceptions.InstallError]: keep_outdated=keep_outdated
[pipenv.exceptions.InstallError]: File "/home/andrew/.local/lib/python3.5/site-packages/pipenv/core.py", line 1253, in do_init
[pipenv.exceptions.InstallError]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.InstallError]: File "/home/andrew/.local/lib/python3.5/site-packages/pipenv/core.py", line 859, in do_install_dependencies
[pipenv.exceptions.InstallError]: retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[pipenv.exceptions.InstallError]: File "/home/andrew/.local/lib/python3.5/site-packages/pipenv/core.py", line 763, in batch_install
[pipenv.exceptions.InstallError]: _cleanup_procs(procs, not blocking, failed_deps_queue, retry=retry)
[pipenv.exceptions.InstallError]: File "/home/andrew/.local/lib/python3.5/site-packages/pipenv/core.py", line 681, in _cleanup_procs
[pipenv.exceptions.InstallError]: raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: ['Collecting psycopg2==2.8.2 (from -r /tmp/pipenv-iaa8p0mr-requirements/pipenv-n1t1lb2p-requirement.txt (line 1))', ' Using cached https://files.pythonhosted.org/packages/23/7e/93c325482c328619870b6cd09370f6dbe1148283daca65115cd63642e60f/psycopg2-2.8.2.tar.gz']
[pipenv.exceptions.InstallError]: ['ERROR: Complete output from command python setup.py egg_info:', ' ERROR: running egg_info', ' creating pip-egg-info/psycopg2.egg-info', ' writing pip-egg-info/psycopg2.egg-info/PKG-INFO', ' writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt', ' writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt', " writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'", ' ', ' Error: pg_config executable not found.', ' ', ' pg_config is required to build psycopg2 from source. Please add the directory', ' containing pg_config to the $PATH or specify the full executable path with the', ' option:', ' ', ' python setup.py build_ext --pg-config /path/to/pg_config build ...', ' ', " or with the pg_config option in 'setup.cfg'.", ' ', ' If you prefer to avoid building psycopg2 from source, please install the PyPI', " 'psycopg2-binary' package instead.", ' ', " For further information please check the 'doc/src/install.rst' file (also at", ' <http://initd.org/psycopg/docs/install.html>).', ' ', ' ----------------------------------------', 'ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-kjdpr2oc/psycopg2/']
ERROR: ERROR: Package installation failed...
作为一种解决方法,在本地工作时,我会注释掉
import django_heroku
django_heroku.settings(locals())
settings.py
然后在推到heroku时取消注释它们。工作正常,但我希望added settings lines for heroku
每次推送到 heroku 时都不会对消息进行新的提交。
关于如何让 django-heroku 实际安装 pipenv 的任何建议?
非常感谢!
解决方案
错误是pg_config is required to build psycopg2 from source. Please add the directory
。所以我sudo apt-get install python-psycopg2
为ubuntu做了。如果它不适用于您的操作系统,请尝试遵循
http://initd.org/psycopg/docs/install.html#install-from-source
推荐阅读
- java - Java 字符串指数
- sql - 如何有效地从同一个表中的不同列和行返回数据?
- firebase - Flutter Firestore 和 StreamBuilder
- vba - 使用 VBA 将多个 Outlook 电子邮件保存到驱动器
- python-3.x - 密码学解密问题
- python - 在具有 DateTime 索引的 Pandas DataFrame 中查找每天第一次和最后一次出现的值的索引位置
- r - 从列表中提取值和属性并将它们转换为 R 中的数据框
- python - 如何在 Reportlab 中根据来自不同文档的信息生成 pdf?
- bash - 从远程 ssh 服务器上的 tar 存档中提取某些文件
- reactjs - 每次显示组件时如何调用函数?