pip freeze does not show all installed packages

后端 未结 5 1725
礼貌的吻别
礼貌的吻别 2020-12-17 19:13

I am using a virtualenv. I have fabric installed, with pip. But a pip freeze does not give any hint about that. The packa

相关标签:
5条回答
  • 2020-12-17 19:20

    I just tried this myself:

    create a virtualenv in to the "env" directory:

    $virtualenv2.7 --distribute env
    New python executable in env/bin/python
    Installing distribute....done.
    Installing pip................done.
    

    next, activate the virtual environment:

    $source env/bin/activate
    

    the prompt changed. now install fabric:

    (env)$pip install fabric
    Downloading/unpacking fabric
      Downloading Fabric-1.6.1.tar.gz (216Kb): 216Kb downloaded
      Running setup.py egg_info for package fabric   
    ...
    
    Successfully installed fabric paramiko pycrypto
    Cleaning up...
    

    And pip freeze shows the correct result:

    (env)$pip freeze
    Fabric==1.6.1
    distribute==0.6.27
    paramiko==1.10.1
    pycrypto==2.6
    wsgiref==0.1.2
    

    Maybe you forgot to activate the virtual environment? On a *nix console type which pip to find out.

    0 讨论(0)
  • 2020-12-17 19:21

    Although your problem was specifically due to a typo, to help other users:

    pip freeze doesn't show the dependencies that pip depends on. If you want to obtain all packages you can use pip freeze --all or pip list.

    0 讨论(0)
  • 2020-12-17 19:28

    Adding my fix in addition of above fix also , I was also facing the same issue on windows,even after activating the virtualenv too pip freeze was not giving me all list of installed packages. So i upgraded my pip with python -m pip install --upgrade pip command and then used pip freeze. This time it worked and gave me all list of installed packages.

    0 讨论(0)
  • 2020-12-17 19:31

    You can try using the --all flag, like this:

    pip freeze --all > requirements.txt
    
    0 讨论(0)
  • 2020-12-17 19:41

    If you have redirected all the pre-installed packages in a file named pip-requirements.txt then it is pretty simple to fix the above issue.

    1) Delete your virtualenv folder or create new one (I am giving it a name as venv)

    rm -rf venv && virtualenv venv
    

    2) Install all the requirements/dependencies from the pip-requirements.txt

    pip install -r pip-requirements.txt
    

    3) Now you can check the installed packages for your Django application

    pip freeze

    4) If you had forgotten to update your requirements file(pip-requirements.txt), then install fabric again (Optional Step)

    Note: After installing any dependency for your Django app, always update the requirements in any file as follows (make sure your virtualenv is activated)

    pip freeze > pip requirements.txt
    

    That's it.

    0 讨论(0)
提交回复
热议问题