当我尝试推送我的新项目时,当我在终端中运行git push heroku main时,我遇到了以下错误:
remote: INFO: pip is looking at multiple versions of pypiwin32 to determine which version is compatible with other requirements. This could take a while.
remote: ERROR: Ignored the following versions that require a different python version: 1.9.5 Requires-Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <3.
7
remote: ERROR: Could not find a version that satisfies the requirement pywin32>=223 (from pypiwin32) (from versions: none)
remote: ERROR: No matching distribution found for pywin32>=223
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
这是我的requirements.txt
文件
asgiref==3.3.2
astroid==2.4.2
asttokens==2.2.1
backcall==0.2.0
beautifulsoup4==4.9.3
bootstrap4==0.1.0
boto==2.49.0
boto3==1.17.101
botocore==1.20.101
cffi==1.14.5
chromelogger==0.4.3
colorama==0.4.4
comm==0.1.2
debugpy==1.6.6
decorator==5.1.1
distro==1.5.0
dj-database-url==2.0.0
Django==3.2
django-bootstrap3==14.2.0
django-bootstrap4==3.0.1
django-braces==1.14.0
django-crispy-forms==1.11.2
django-debug-toolbar==3.2.1
django-developer-panel==0.1.2
django-misaka==0.2.1
django-storages==1.11.1
django-widget-tweaks==1.4.8
executing==1.2.0
google-compute-engine==2.8.13
gunicorn==20.1.0
houdini.py==0.1.0
importlib-metadata==6.0.0
ipykernel==6.21.2
ipython==8.10.0
isort==5.7.0
jedi==0.18.0
jmespath==0.10.0
jsonpickle==2.0.0
jupyter_client==8.0.3
jupyter_core==5.2.0
lazy-object-proxy==1.4.3
matplotlib-inline==0.1.6
mccabe==0.6.1
misaka==2.1.1
nest-asyncio==1.5.6
numpy==1.24.2
ordereddict==1.1
packaging==23.0
pandas==1.5.3
parso==0.8.1
pickleshare==0.7.5
Pillow==8.2.0
platformdirs==3.0.0
prompt-toolkit==3.0.37
psutil==5.9.4
psycopg2==2.9.6
psycopg2-binary==2.9.6
pure-eval==0.2.2
pycparser==2.20
Pygments==2.9.0
pylint==2.6.0
pypiwin32==223
python-dateutil==2.8.1
pytz==2021.1
pywin32==305
pyzmq==25.0.0
s3transfer==0.4.2
six==1.15.0
soupsieve==2.2.1
sqlparse==0.4.1
stack-data==0.6.2
toml==0.10.2
tornado==6.2
traitlets==5.9.0
typing_extensions==4.5.0
tzdata==2023.3
urllib3==1.26.6
wcwidth==0.2.6
whitenoise==5.2.0
wrapt==1.12.1
zipp==3.14.0
而且我在runtime.txt
文件中使用了python-3.9.16。我该如何解决这个问题?这是非常恼人的,我已经试图切换版本,但我仍然得到同样的错误一遍又一遍
1条答案
按热度按时间tzdcorbm1#
这里的问题似乎是您试图安装的模块pywin32与Heroku不兼容,Heroku是一个基于Linux的平台。
pywin32是一组用于Windows的Python扩展,因此,它们与Heroku等非Windows平台不兼容。
在
requirements.txt
文件中,您指定安装pypiwin32==223
和pywin32==305
,这在Heroku上不起作用。作为noted here,您可以使用Python中的环境标记来基于系统平台有条件地安装包。
在
requirements.txt
中,您可以指定pywin32
和pypiwin32
仅应安装在Windows上,方法是将; platform_system == "Windows"
添加到这些行的末尾。这样,当Heroku(Linux系统)读取文件时,它将跳过这些包。您的
requirements.txt
文件应该如下所示:通过这样做,
pywin32
和pypiwin32
将仅在platform_system
为“Windows”时安装。当Heroku尝试安装依赖项时,它应该忽略这两个。修改
requirements.txt
文件后,提交更改并再次推送到Heroku: