英文:
pip download mirror in requirements.txt or venv
问题
有没有办法在 requirements.txt 文件中修复 PyPi 下载镜像?或者在其他自动选择的地方修复?我在中国,通常会使用备用镜像,因为主要镜像可能会很慢,例如:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
今天这导致我很困惑,因为我的 Python 代码和 requirements.txt 在不同的机器上产生了意外和不同的结果。
英文:
Is there a way to fix the PyPi download mirror in a requirements.txt file? or somewhere else that gets picked up automatically? I'm based in China, and it's often convenient to use an alternative mirror as the main one can be slow e.g.
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
Today this caused me a lot of confusion, as my Python code & requirements.txt produced unexpected and different results on different machines.
答案1
得分: 3
你可以在你的requirements.txt文件中添加以下内容:
--index-url https://pypi.tuna.tsinghua.edu.cn/simple
请查看文档。
英文:
You should be able to just include
--index-url https://pypi.tuna.tsinghua.edu.cn/simple
in your requirements.txt file. See the documentation
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论