当我try 推送我的新项目时,在我的终端中运行git推送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.我怎么才能解决这个问题呢?这变得非常恼人,我试图切换版本,但仍然一次又一次地收到相同的错误

推荐答案

The problem here seems to be that pywin32, the module you are trying to install, is not compatible with Heroku, which is a Linux-based platform.
pywin32 is a set of Python extensions for Windows, and as such, they are not compatible with non-Windows platforms like Heroku.

在您的requirements.txt文件中,您指定安装pypiwin32==223pywin32==305,这在Heroku上不起作用.

作为noted here,您可以使用Python中的环境标记来有条件地安装基于系统平台的包.

在您的requirements.txt中,您可以指定pywin32pypiwin32只应安装在Windows上,方法是在这些行的末尾添加; platform_system == "Windows".这样,当Heroku(Linux系统)读取该文件时,它将跳过这些包.

您的requirements.txt文件应该如下所示:

...
# Other dependencies
...
pypiwin32==223; platform_system == "Windows"
pywin32==305; platform_system == "Windows"
...
# Other dependencies
...

通过这样做,只有当platform_system是"Windows"时,才会安装pywin32pypiwin32.当Herokutry 安装依赖项时,它应该忽略这两个.

修改requirements.txt文件后,提交更改并再次推送到Heroku:

git add requirements.txt
git commit -m "Conditionally install Windows-specific packages"
git push heroku main

Python相关问答推荐

如何随着收件箱的增加动态添加到HTML表的右下角?

是否有使用纯霍夫曼编码的现代图像格式?

try 从网站获取表(ValueRight:如果使用所有纯量值,则必须传递索引)

在IIS中运行的FastAPI-获取权限错误:[Win错误10013]试图以其访问权限禁止的方式访问插槽

如何修复fpdf中的线路出血

Plotly:如何更改Heatmap中彩色条的勾选文本

inspect_asm不给出输出

替换字符串中的点/逗号,以便可以将其转换为浮动

如何根据情况丢弃大Pandas 的前n行,使大Pandas 的其余部分完好无损

如何用symy更新分段函数

跟踪我已从数组中 Select 的样本的最有效方法

如何在Deliveryter笔记本中从同步上下文正确地安排和等待Delivercio代码中的结果?

使用FASTCGI在IIS上运行Django频道

我想一列Panadas的Rashrame,这是一个URL,我保存为CSV,可以直接点击

什么是合并两个embrame的最佳方法,其中一个有日期范围,另一个有日期没有任何共享列?

如何在FastAPI中为我上传的json文件提供索引ID?

需要帮助重新调整python fill_between与数据点

如何在PySide/Qt QColumbnView中删除列

如何使用两个关键函数来排序一个多索引框架?

如何检测鼠标/键盘的空闲时间,而不是其他输入设备?