How can I make a list of installed packages in a certain virtualenv?

后端 未结 9 1359

You can cd to YOUR_ENV/lib/pythonxx/site-packages/ and have a look, but is there any convenient ways?

pip freeze list all the

9条回答
  •  鱼传尺愫
    2020-12-02 12:28

    If you're still a bit confused about virtualenv you might not pick up how to combine the great tips from the answers by Ioannis and Sascha. I.e. this is the basic command you need:

    /YOUR_ENV/bin/pip freeze --local
    

    That can be easily used elsewhere. E.g. here is a convenient and complete answer, suited for getting all the local packages installed in all the environments you set up via virtualenvwrapper:

    cd ${WORKON_HOME:-~/.virtualenvs}
    for dir in *; do [ -d $dir ] && $dir/bin/pip freeze --local >  /tmp/$dir.fl; done
    more /tmp/*.fl
    

提交回复
热议问题