pip freeze 不显示包

max*_*sme 5 python pip

例如,如果在使用 pip 安装 Tornado 之后,如下所示:

pip install tornado
Collecting tornado
...
Successfully installed backports-abc certifi singledispatch six tornado
Run Code Online (Sandbox Code Playgroud)

pip freeze 不返回列表中的龙卷风包,它只显示:

PyMySQL==0.7.2
Run Code Online (Sandbox Code Playgroud)

当我运行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:

    ''
Run Code Online (Sandbox Code Playgroud)

出了什么问题?

Pro*_*o Q 5

当使用 virtualenvwrapper 或其他虚拟环境时(这可能不是你的情况,但我是如何得出这个问题的),你可能已经安装了一些东西,sudo它将为你的整个系统安装它们。(看这里

因此,pip freeze实际上是有效的,你只是没有用那个点实际安装任何东西。