`pip freeze > requirements.txt` 命令输出文件中出现文件路径而非版本号

pip freeze > requirements.txt 命令输出文件中出现文件路径而非版本号

appdirs==1.4.4
black==21.6b0
certifi==2021.5.30
click @ file:///tmp/build/80754af9/click_1621604852318/work
colorama==0.4.4
dnspython==2.1.0
email-validator==1.1.3
Flask @ file:///home/ktietz/src/ci/flask_1611932660458/work
Flask-Login==0.5.0
flask-mongoengine==1.0.0
Flask-WTF==0.15.1
idna==3.2
importlib-metadata @ file:///C:/ci/importlib-metadata_1617877486026/work
itsdangerous @ file:///tmp/build/80754af9/itsdangerous_1621432558163/work
Jinja2 @ file:///tmp/build/80754af9/jinja2_1624781299557/work
MarkupSafe @ file:///C:/ci/markupsafe_1621528383308/work
mongoengine==0.23.1
mypy-extensions==0.4.3
pathspec==0.8.1
pymongo==3.12.0
regex==2021.7.6
toml==0.10.2
typed-ast==1.4.3
typing-extensions @ file:///tmp/build/80754af9/typing_extensions_1624965014186/work
Werkzeug @ file:///home/ktietz/src/ci/werkzeug_1611932622770/work
wincertstore==0.2
WTForms==2.3.3
zipp @ file:///tmp/build/80754af9/zipp_1625570634446/work

解决办法:

pip list --format=freeze > requirements.txt

输出结果:

appdirs==1.4.4
black==21.6b0
certifi==2021.5.30
click==8.0.1
colorama==0.4.4
dnspython==2.1.0
email-validator==1.1.3
Flask==1.1.2
Flask-Login==0.5.0
flask-mongoengine==1.0.0
Flask-WTF==0.15.1
idna==3.2
importlib-metadata==3.10.0
itsdangerous==2.0.1
Jinja2==3.0.1
MarkupSafe==2.0.1
mongoengine==0.23.1
mypy-extensions==0.4.3
pathspec==0.8.1
pip==21.1.3
pymongo==3.12.0
regex==2021.7.6
setuptools==52.0.0.post20210125
toml==0.10.2
typed-ast==1.4.3
typing-extensions==3.10.0.0
Werkzeug==1.0.1
wheel==0.36.2
wincertstore==0.2
WTForms==2.3.3
zipp==3.5.0

参考链接:How do I remove unwanted paths in requirements.txt?

上一篇:[Linux]Shell编程【待续】


下一篇:线程与进程的一些应用