懒猫 ENV 查看器第二版更新的时候,审核人员和我说遇到了这个错误。说来也奇怪,都用了 docker 了,也会遇到依赖的问题。

https://appstore.lazycat.cloud/#/shop/detail/xu.deploy.env
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE
Expected sha256 4ceb…
Got 5519987f…
因为 pip 在校验阶段就失败,后面的 Flask 等依赖都没装上,于是程序启动时报 ModuleNotFoundError: No module named ‘flask’。
最后我还是替换掉了腾讯云。以清华源为主,其他源为辅:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| #!/bin/sh
cd "$(dirname "$0")" sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories apk update apk add python3 py3-pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip config set global.extra-index-url https://mirrors.aliyun.com/pypi/simple/ pip config set global.extra-index-url https://repo.huaweicloud.com/repository/pypi/simple/ pip config set global.extra-index-url https://mirrors.cloud.tencent.com/pypi/simple/ pip install -r ./requirements.txt --break-system-packages python3 app.py
|
网上还有几种办法,后面再遇到的时候可以再尝试:
- –no-cache-dir
- pip cache purge
- pip install –trusted-host=pypi.org –trusted-host=files.pythonhosted.org example_package
- rm ~/.cache/pip -rf
- 关闭机器代理
参考链接:
https://stackoverflow.com/questions/71435874/pip-these-packages-do-not-match-the-hashes-from-the-requirements-file