How to freeze packages installed only in the virtual environment, that is, without the global ones?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Try the following command:
Only local packages on virtual environment
Only local packages installed by the user on virtual environment
See the documentation for further details: https://pip.pypa.io/en/stable/reference/pip_freeze/.
You need to use the
-l
or--local
option to freeze only the local packages (and not the global ones)Make sure you are working in the
virtualenv
before doingpip freeze -l
.Install whatever you need to freeze in your virtual environment, and then
After that install the packages in the virtual environment that you do not want to freeze.
I'm on Windows 10, python 3.6, with my virtual environment called env activated using command prompt I found that
pip freeze -l
does not work (error),python -m pip freeze -l
does not work (gets global packages) but changing into my virtual environment Scripts directory and runningpip freeze
orpip freeze -l
works. Here is an example of this solution/work-around with my virtual environment, env: