這是我在嘗試推送時遇到的錯誤,一周前一切正常,我可以毫無問題地部署。現在,當我嘗試部署時,我總是收到此錯誤,因為我無法同時滿足 python-dateutil==2.8(應用程式需要)和 python-dateutl==1.5(heroku 需要)。不知道為什么這開始發生。(在全球范圍內更新了 heroku,但沒有任何改變)。有一個包裝器Heroku3,但我似乎無法使用它來部署,當我在 env 中安裝它時,heroku3 命令不存在并且它在 npm 上不可用,所以我所能做的就是用它撰寫 python 代碼。如果有人知道如何解決這個問題,將不勝感激。
git push heroku master
Enumerating objects: 401, done.
Counting objects: 100% (401/401), done.
Delta compression using up to 16 threads
Compressing objects: 100% (321/321), done.
Writing objects: 100% (386/386), 226.01 KiB | 4.43 MiB/s, done.
Total 386 (delta 39), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/python
remote: -----> Python app detected
remote: -----> No Python version was specified. Using the same version as the last build: python-3.9.7
remote: To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> No change in requirements detected, installing from cache
remote: -----> Using cached install of python-3.9.7
remote: -----> Installing pip 21.3.1, setuptools 57.5.0 and wheel 0.37.0
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: INFO: pip is looking at multiple versions of gunicorn to determine which version is compatible with other requirements. This could take a while.
remote: Collecting gunicorn==20.1.0
remote: Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB)
remote: INFO: pip is looking at multiple versions of django-storages to determine which version is compatible with other requirements. This could take a while.
remote: Collecting django-storages==1.11.1
remote: Downloading django_storages-1.11.1-py3-none-any.whl (42 kB)
remote: INFO: pip is looking at multiple versions of django-heroku to determine which version is compatible with other requirements. This could take a while.
remote: Collecting django-heroku==0.3.1
remote: Downloading django_heroku-0.3.1-py2.py3-none-any.whl (6.2 kB)
remote: INFO: pip is looking at multiple versions of django-crispy-forms to determine which version is compatible with other requirements. This could take a while.
remote: Collecting django-crispy-forms==1.12.0
remote: Downloading django_crispy_forms-1.12.0-py3-none-any.whl (122 kB)
remote: INFO: pip is looking at multiple versions of django to determine which version is compatible with other requirements. This could take a while.
remote: Collecting Django==3.2.7
remote: Downloading Django-3.2.7-py3-none-any.whl (7.9 MB)
remote: INFO: pip is looking at multiple versions of dj-database-url to determine which version is compatible with other requirements. This could take a while.
remote: Collecting dj-database-url==0.5.0
remote: Downloading dj_database_url-0.5.0-py2.py3-none-any.whl (5.5 kB)
remote: INFO: pip is looking at multiple versions of charset-normalizer to determine which version is compatible with other requirements. This could take a while.
remote: Collecting charset-normalizer==2.0.4
remote: Downloading charset_normalizer-2.0.4-py3-none-any.whl (36 kB)
remote: INFO: pip is looking at multiple versions of certifi to determine which version is compatible with other requirements. This could take a while.
remote: Collecting certifi==2021.5.30
remote: Downloading certifi-2021.5.30-py2.py3-none-any.whl (145 kB)
remote: INFO: pip is looking at multiple versions of botocore to determine which version is compatible with other requirements. This could take a while.
remote: Collecting botocore==1.21.39
remote: Downloading botocore-1.21.39-py3-none-any.whl (7.9 MB)
remote: INFO: pip is looking at multiple versions of <Python from Requires-Python> to determine which version is compatible with other requirements. This could take a while.
remote: INFO: pip is looking at multiple versions of boto3 to determine which version is compatible with other requirements. This could take a while.
remote: Collecting boto3==1.18.39
remote: Downloading boto3-1.18.39-py3-none-any.whl (131 kB)
remote: INFO: pip is looking at multiple versions of beautifulsoup4 to determine which version is compatible with other requirements. This could take a while.
remote: Collecting beautifulsoup4==4.9.3
remote: Downloading beautifulsoup4-4.9.3-py3-none-any.whl (115 kB)
remote: INFO: pip is looking at multiple versions of asgiref to determine which version is compatible with other requirements. This could take a while.
remote: Collecting asgiref==3.4.1
remote: Downloading asgiref-3.4.1-py3-none-any.whl (25 kB)
remote: INFO: pip is looking at multiple versions of botocore to determine which version is compatible with other requirements. This could take a while.
remote: ERROR: Cannot install -r /tmp/build_414b410f/requirements.txt (line 4), heroku==0.1.4 and python-dateutil==2.8.2 because these package versions have conflicting dependencies.
remote:
remote: The conflict is caused by:
remote: The user requested python-dateutil==2.8.2
remote: botocore 1.21.39 depends on python-dateutil<3.0.0 and >=2.1
remote:
remote: To fix this you could try to:
remote: 1. loosen the range of package versions you've specified
remote: 2. remove package versions to allow pip attempt to solve the dependency conflict
remote:
remote: ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: 37f55b221f93a23b73486ebf55520365c1b5bcb8
remote: !
remote: ! We have detected that you have triggered a build from source code with version 37f55b221f93a23b73486ebf55520365c1b5bcb8
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to app.
remote:
To gitlink
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'gitlink'
當我執行 pip freeze 我得到這個
asgiref==3.4.1
beautifulsoup4==4.9.3
boto3==1.18.39
botocore==1.21.39
certifi==2021.5.30
charset-normalizer==2.0.4
click==8.0.1
colorama==0.4.4
dj-database-url==0.5.0
Django==3.2.7
django-click==2.3.0
django-crispy-forms==1.12.0
django-heroku==0.3.1
django-pg-copy==0.4.0
django-storages==1.11.1
gunicorn==20.1.0
heroku3==5.1.4
idna==3.2
jmespath==0.10.0
pep517==0.12.0
Pillow==8.3.2
postgres==3.0.0
postgres.client==0.4.6
psycopg2==2.9.1
psycopg2-binary==2.9.1
psycopg2-pool==1.1
PyOpenGL==3.1.5
python-dateutil==2.8.2
python-decouple==3.4
pytz==2021.1
requests==2.26.0
s3transfer==0.5.0
six==1.16.0
soupsieve==2.2.1
sqlparse==0.4.1
tomli==1.2.2
urllib3==1.26.6
whitenoise==5.3.0
uj5u.com熱心網友回復:
asgiref==3.4.1
beautifulsoup4==4.9.3
python-dateutil
boto3==1.18.39
botocore==1.21.39
certifi==2021.5.30
charset-normalizer==2.0.4
click==8.0.1
colorama==0.4.4
dj-database-url==0.5.0
Django==3.2.7
django-click==2.3.0
django-crispy-forms==1.12.0
django-heroku==0.3.1
django-pg-copy==0.4.0
django-storages==1.11.1
gunicorn==20.1.0
heroku3==5.1.4
idna==3.2
jmespath==0.10.0
pep517==0.12.0
Pillow==8.3.2
postgres==3.0.0
postgres.client==0.4.6
psycopg2==2.9.1
psycopg2-binary==2.9.1
psycopg2-pool==1.1
PyOpenGL==3.1.5
python-decouple==3.4
pytz==2021.1
requests==2.26.0
s3transfer==0.5.0
six==1.16.0
soupsieve==2.2.1
sqlparse==0.4.1
tomli==1.2.2
urllib3==1.26.6
whitenoise==5.3.0
unversion python-dateutil 如果不起作用,請訪問https://pypi.org/project/python-dateutil/#history 并執行以下操作,嘗試多次嘗試,每次都部署到 heroku
- 得到了 requirements.txt 并更改為 python-dateutil==2.5.1 如果不起作用嘗試較低版本
- 將 Heroku 版本更改為 heroku3==3.1.0
uj5u.com熱心網友回復:
如果在之前的部署中一切正常,您可以登錄 Herokuhttps://dashboard.heroku.com/并打開應用程式的控制臺并獲取當前安裝的庫。
如果您不確定如何操作,Run console按鈕將位于more應用程式右側頂部的按鈕中。然后輸入bash并回車,bash 控制臺將被打開。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/351586.html
上一篇:如何計算Django中的模型物件
