简体   繁体   English

pip freeze 不显示包

[英]pip freeze not showing packages

For example if after installing Tornado with pip like this:例如,如果在使用 pip 安装 Tornado 之后,如下所示:

pip install tornado
Collecting tornado
...
Successfully installed backports-abc certifi singledispatch six tornado

pip freeze doesn't return tornado package in list, it just shows: pip freeze不会在列表中返回 tornado 包,它只是显示:

PyMySQL==0.7.2

also when I run easy_install it returns:当我运行easy_install它也会返回:

error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /lib/python2.7/site-packages/

and your PYTHONPATH environment variable currently contains:

    ''

What is going wrong?出了什么问题?

When using virtualenvwrapper or another virtual environment (which is probably not your case but is how I arrived at this question), you may have installed things using sudo which will install them for your entire system.当使用 virtualenvwrapper 或其他虚拟环境(这可能不是你的情况,但我是如何解决这个问题的)时,你可能已经使用sudo安装了一些东西,这将为你的整个系统安装它们。 ( See here ) 见这里

Therefore, pip freeze actually is working, you just haven't actually installed anything with that pip.因此, pip freeze实际上是有效的,只是您实际上还没有使用该 pip 安装任何东西。

  1. I suppose reinstalling pip may help you:我想重新安装 pip 可能会帮助你:

     pip install --upgrade pip
  2. To fix easy_install problem add /lib/python2.7/site-packages/ to your PYTHONPATH:要修复 easy_install 问题,请将/lib/python2.7/site-packages/添加到您的 PYTHONPATH:

     export PYTHONPATH=$PYTHONPATH:/lib/python2.7/site-packages/

Good Luck !祝你好运!

upgrade pip and it will work.升级pip它将起作用。 I had the exact same problem.我遇到了完全相同的问题。 In my case it wasn't " sudo " related, but upgrading pip via pip install --upgrade pip solved the issue.在我的情况下,它与“ sudo ”无关,但是通过pip install --upgrade pip升级pip install --upgrade pip解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM