【问题标题】:django-heroku is not installingdjango-heroku 没有安装
【发布时间】:2020-12-28 20:05:28
【问题描述】:
Collecting django-heroku
  Using cached django_heroku-0.3.1-py2.py3-none-any.whl (6.2 kB)
Requirement already satisfied: django in /home/aksh/dadu/lib/python3.8/site-packages (from django-heroku) (3.1.1)
Requirement already satisfied: whitenoise in /home/aksh/dadu/lib/python3.8/site-packages (from django-heroku) (5.2.0)
Requirement already satisfied: dj-database-url>=0.5.0 in /home/aksh/dadu/lib/python3.8/site-packages (from django-heroku) (0.5.0)
Collecting psycopg2
  Using cached psycopg2-2.8.6.tar.gz (383 kB)
Requirement already satisfied: asgiref~=3.2.10 in /home/aksh/dadu/lib/python3.8/site-packages (from django->django-heroku) (3.2.10)
Requirement already satisfied: sqlparse>=0.2.2 in /home/aksh/dadu/lib/python3.8/site-packages (from django->django-heroku) (0.3.1)
Requirement already satisfied: pytz in /home/aksh/dadu/lib/python3.8/site-packages (from django->django-heroku) (2020.1)
Building wheels for collected packages: psycopg2
  Building wheel for psycopg2 (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/aksh/dadu/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-a2qiah3p/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-a2qiah3p/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-xvu3w4ef
       cwd: /tmp/pip-install-a2qiah3p/psycopg2/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help
  
  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for psycopg2
  Running setup.py clean for psycopg2
Failed to build psycopg2
Installing collected packages: psycopg2, django-heroku
    Running setup.py install for psycopg2 ... error
    ERROR: Command errored out with exit status 1:
     command: /home/aksh/dadu/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-a2qiah3p/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-a2qiah3p/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-7sdx4nwd/install-record.txt --single-version-externally-managed --compile --install-headers /home/aksh/dadu/include/site/python3.8/psycopg2
         cwd: /tmp/pip-install-a2qiah3p/psycopg2/
    Complete output (40 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/psycopg2
    copying lib/errors.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/compat.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
    running build_ext
    building 'psycopg2._psycopg' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/psycopg
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_VERSION=2.8.6 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120003 -DHAVE_LO64=1 -I/home/aksh/dadu/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement                                                                                                                        
    In file included from psycopg/psycopgmodule.c:28:                                                                                                                                                                                      
    ./psycopg/psycopg.h:36:10: fatal error: libpq-fe.h: No such file or directory                                                                                                                                                          
       36 | #include <libpq-fe.h>                                                                                                                                                                                                          
          |          ^~~~~~~~~~~~                                                                                                                                                                                                          
    compilation terminated. 
                                                                                                                                                                                                                                                                                                                                                                                                                                                      

您似乎缺少从源代码构建包的一些先决条件。

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                                                                                                                                                                        
----------------------------------------                                                                                                                                                                                               

错误:命令出错,退出状态为 1:/home/aksh/dadu/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-a2qiah3p/psycopg2/setup.py'"'"'; 文件='"'"'/tmp/pip-install-a2qiah3p/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- 7sdx4nwd/install-record.txt --single-version-externally-managed --compile --install-headers /home/aksh/dadu/include/site/python3.8/psycopg2 检查日志以获取完整的命令输出。

当 iam 运行命令时,它会出现此错误。 许多其他 python 包也会出现此错误。

还有其他方法可以下载 django-heroku。

【问题讨论】:

  • 错误是针对psycopg2,而不是django-heroku。按照消息的建议,尝试在您的要求中将 psycopg2 更改为 psycopg2-binary
  • 最后一个 django-heroku 版本是在 2018 年。您不需要安装它即可在 Heroku 上运行 Django 应用程序。我不会尝试安装它,除非你绝对确定你需要 - 我认为它不会解决你描述的问题 here

标签: python postgresql heroku pip psycopg2


【解决方案1】:

要在 Heroku 上安装 Django,请转到命令行,而不是:

django-heroku

用途:

pip install django-on-heroku

Source

【讨论】:

    猜你喜欢
    • 2016-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-03
    相关资源
    最近更新 更多