Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django 无法推送到Heroku:/app/.Heroku/python/bin/pip:没有这样的文件或目录_Django_Heroku - Fatal编程技术网

Django 无法推送到Heroku:/app/.Heroku/python/bin/pip:没有这样的文件或目录

Django 无法推送到Heroku:/app/.Heroku/python/bin/pip:没有这样的文件或目录,django,heroku,Django,Heroku,我正试图将Django项目推给Heroku,但它一直告诉我: /app/.heroku/python/bin/pip: No such file or directory 完整的错误消息如下所示。我如何解决这个问题?我需要先在Heroku上安装pip吗 Counting objects: 451, done. Delta compression using up to 8 threads. Compressing objects: 100% (383/383), done. Writing o

我正试图将Django项目推给Heroku,但它一直告诉我:

/app/.heroku/python/bin/pip: No such file or directory
完整的错误消息如下所示。我如何解决这个问题?我需要先在Heroku上安装pip吗

Counting objects: 451, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (383/383), done.
Writing objects: 100% (451/451), 1.07 MiB | 349.00 KiB/s, done.
Total 451 (delta 87), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.5.1
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote:        /app/tmp/buildpacks/779a8bbfbbe7e1b715476c0b23fc63a2103b3e4131eda558669aba8fb5e6e05682419376144189b29beb5dee6d7626b4d3385edb0954bffea6c67d8cf622fd51
/bin/steps/pip-install: line 5: /app/.heroku/python/bin/pip: No such file or directory
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !   Push rejected to rocky-tor-70537.
remote:
To https://git.heroku.com/rocky-tor-70537.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/rocky-tor-70537.git'
我的requirements.txt文件为空,如下所示

# this is for Heroku and other servers.
# Locally, you should install requirements_base.txt
-r requirements_server.txt
我的要求\u server.txt如下:

-r requirements_base.txt
# packages that are unnecessary on Windows/Mac local dev environments, or don't install properly
psycopg2>=2.5.1
appdirs==1.4.3
asgi-redis==0.14.1
asgiref==0.14.0
autobahn==0.16.0
Babel==2.3.4
boto==2.42.0
channels==0.17.3
colorama==0.3.7
contextlib2==0.5.4
coverage==4.2
daphne==0.14.3
dj-database-url==0.4.1
Django==1.8.8
django-countries==4.0
django-easymoney==0.7.1
django-floppyforms==1.7.0
django-idmap==0.4.1
django-vanilla-views==1.0.4
djangorestframework==3.4.6
honcho==0.7.1
huey==1.2.0
IPy==0.83
mock==2.0.0
msgpack-python==0.4.8
otree-core==1.2.8
otree-save-the-change==1.1.3
packaging==16.8
pbr==1.10.0
py==1.4.31
pyparsing==2.2.0
pytest==2.9.2
pytest-django==3.0.0
python-redis-lock==3.2.0
pytz==2016.6.1
raven==5.25.0
redis==2.10.5
requests==2.11.1
schema==0.6.2
six==1.10.0
Twisted==16.2.0
txaio==2.5.1
unicodecsv==0.14.1
whitenoise==3.2.1
ws4py==0.3.5
XlsxWriter==0.9.3
zope.interface==4.2.0
我的要求\u base.txt如下:

-r requirements_base.txt
# packages that are unnecessary on Windows/Mac local dev environments, or don't install properly
psycopg2>=2.5.1
appdirs==1.4.3
asgi-redis==0.14.1
asgiref==0.14.0
autobahn==0.16.0
Babel==2.3.4
boto==2.42.0
channels==0.17.3
colorama==0.3.7
contextlib2==0.5.4
coverage==4.2
daphne==0.14.3
dj-database-url==0.4.1
Django==1.8.8
django-countries==4.0
django-easymoney==0.7.1
django-floppyforms==1.7.0
django-idmap==0.4.1
django-vanilla-views==1.0.4
djangorestframework==3.4.6
honcho==0.7.1
huey==1.2.0
IPy==0.83
mock==2.0.0
msgpack-python==0.4.8
otree-core==1.2.8
otree-save-the-change==1.1.3
packaging==16.8
pbr==1.10.0
py==1.4.31
pyparsing==2.2.0
pytest==2.9.2
pytest-django==3.0.0
python-redis-lock==3.2.0
pytz==2016.6.1
raven==5.25.0
redis==2.10.5
requests==2.11.1
schema==0.6.2
six==1.10.0
Twisted==16.2.0
txaio==2.5.1
unicodecsv==0.14.1
whitenoise==3.2.1
ws4py==0.3.5
XlsxWriter==0.9.3
zope.interface==4.2.0

如果您使用的是默认的heroku buildpack,我猜您的项目文件夹中的requirements.txt文件丢失了

我最近遇到了这个问题,并且能够通过在runtime.txt中更改python版本来调整它

改为

python-3.5.2
但是,根据您列出的需求,您似乎永远无法访问requirements_base.txt

在requirements_server.txt文件中,将其更改为:

-r requirements_base.txt 

在Ubuntu 16.04和手动安装Heroku CLI之后,我遇到了同样的问题,使用

wget https://cli-assets.heroku.com/branches/stable/heroku-REPLACE_ME_OS-REPLACE_ME_ARCH.tar.gz -O heroku.tar.gz

mkdir -p /usr/local/lib

tar -xvzf heroku.tar.gz -C /usr/local/lib

/usr/local/lib/heroku/install
它就像一个符咒

在文件夹中我有4个文件。一个是python脚本,第二个是procfile(无扩展名),内容
web:gunicornskripta1:app
。第三个是requirements.txt,包含:

appdirs==1.4.3
bokeh==0.12.5
click==6.7
Flask==0.12.2
gunicorn==19.7.1
itsdangerous==0.24
Jinja2==2.9.6
MarkupSafe==1.0
numpy==1.12.1
packaging==16.8
pandas==0.20.1
pandas-datareader==0.4.0
pyparsing==2.2.0
python-dateutil==2.6.0
pytz==2017.2
PyYAML==3.12
requests==2.14.2
requests-file==1.4.2
requests-ftp==0.3.1
six==1.10.0
tornado==4.5.1
Werkzeug==0.12.2 

第四个是runtime.txt,带有
python-3.5.2

根据Heroku文档,仅有两个官方支持的python运行时是2.7.13和3.6.1。
最近,我在heroku的oTree部署中遇到了同样的问题,但当我将
runtime.txt
更改为
python-3.6.1
时,一切都进展顺利。

我的
runtime.txt

确保它显示的是
python-3.6.1
,而不是
python-3.6.1
python 3.6.1


错误消息非常糟糕。希望这篇文章能为你节省30分钟。

哦,天哪-我删除了我的
需求/production.txt
中的一个空行,以便尝试更改行号,然后一切都开始工作了(或者更确切地说,我的下一个完全不同的错误)

我在Windows上尝试将Python应用程序部署到Heroku时遇到了同样的问题。原来是文件编码问题。根据您创建Procfile、requirements.txt和runtime.txt的方式,您的编码可能会有所不同

假设您正在运行Windows,请使用PowerShell。获取以下内容并将其粘贴到PowerShell控制台。使用此选项,您可以检查文件编码:

获取fileencoding requirements.txt
如果它返回ascii以外的任何东西,这可能就是问题所在。在我的例子中,我的三个文件都是unicode。我这样做只是为了强迫他们使用ASCII:

“python-3.6.1”输出文件-en ascii runtime.txt
您还可以使用编辑器,然后使用ASCII编码保存文件


一旦我对Procfile、requirements.txt和runtime.txt进行了更改,我就能够成功地部署到Heroku。

看起来Heroku现在只支持Python版本


我从app engine切换到heroku,根目录中有一个setup.cfg文件,其中包含以下内容:

[install]
prefix= 

它在部署时导致此问题。移除后,一切都进行得很顺利。

出于某种原因,它对我不起作用。仍在接收相同的错误消息。我不知道当我将runtime.txt更改为python的其他版本(我尝试了3.6.1和3.5.2)时,为什么它仍然尝试安装python-3.5.1。还有其他地方可以指定使用的python版本吗?你能发布requirements.txt文件吗?编辑注释以反映requirements.txt文件的问题。很抱歉,我错误地键入了requirements\u server,它应该是requirements\u base。因此,我实际上在我的requirements_server.txt文件中有上面这一行。使用python-3.5.1并面对这个问题。但不知何故,python3.5.2工作得非常完美。我有requirements.txt。您是否使用一些定制的构建包?您可以尝试一下
heroku config:unset BUILDPACK\u URL
并再次推送您的代码以检查BUILDPACK吗?我使用了上面的命令,仍然收到相同的错误消息。谢谢!有
python2.7.13
但需要
python-2.7.13
。愚蠢的是,如果您缺少
-
直到它尝试使用
pip
,它将继续正常运行。您好,您是否能够解决此问题?我在windows上也遇到同样的问题