python创建虚拟环境,安装requirements.txt里面的packages

 

FreeBSD:

python -m venv /path/to/new/virtual/environment

比如:

python -m venv /home/euler/.myvenv

source .myvenv/bin/activate

pip install -r requirements.txt

#退出时输入: deactivate

 

 

how to freeze packages installed only in my virtual environment:

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

python
pip freeze -l > requirements.txt 

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

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

 

 

posted @ 2025-02-27 23:34  profesor  阅读(30)  评论(0)    收藏  举报