How to freeze packages installed only in the virtual environment?

…衆ロ難τιáo~ 提交于 2019-12-03 04:44:13

问题


How to freeze packages installed only in the virtual environment, that is, without the global ones?


回答1:


You need to use the -l or --local option to freeze only the local packages (and not the global ones)

pip freeze -l > requirements.txt 

Make sure you are working in the virtualenv before doing pip freeze -l.




回答2:


Only local packages on virtual environment

pip freeze -l > requirements.txt # or --local instead of -l

Only local packages installed by the user on virtual environment

pip freeze --user > requirements.txt

See the documentation for further details: https://pip.pypa.io/en/stable/reference/pip_freeze/.




回答3:


Install whatever you need to freeze in your virtual environment, and then

pip freeze > requirements.txt

After that install the packages in the virtual environment that you do not want to freeze.




回答4:


Try the following command:

pip -E /path/to/env/ freeze


来源:https://stackoverflow.com/questions/8073097/how-to-freeze-packages-installed-only-in-the-virtual-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!