[英]Why does `pip freeze` result in an empty file?
I'm following the tutorial to deploy Django applications on Heroku.我正在按照教程在 Heroku 上部署 Django 应用程序。
In the 5th line of the code, it says pip freeze > requirements.txt
but when I run it (from the venv
), the requirements.txt
file is empty.在代码的第 5 行,它
pip freeze > requirements.txt
但是当我运行它(从venv
)时, requirements.txt
文件是空的。 It produced 6-7 dependencies with the same code before.它之前使用相同的代码生成了 6-7 个依赖项。
How can I fix this?我怎样才能解决这个问题?
这可能意味着依赖项已安装在全局环境中,切换到venv,然后使用pip install <dependency>
手动pip install <dependency>
,然后运行pip freeze
Frozen应该输出依赖项
This answer is for posterity这个答案是为了后代
python -m pip install -–upgrade pip
Then run pip freeze > requirements.txt
as usually.This should do the job.然后像往常一样运行
pip freeze > requirements.txt
。这应该可以完成这项工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.