为什么 pip 冻结列表 "pkg-resources==0.0.0"?
Why does pip freeze list "pkg-resources==0.0.0"?
在 Ubuntu 16.04 上使用 virtualenv 15.0.1 和 Python 3.5.2(均与 apt
一起安装)当我创建并激活新的 Python 虚拟环境时
virtualenv .virtualenvs/wtf -p $(which python3) --no-site-packages
source .virtualenvs/wtf/bin/activate
我得到以下输出:
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/das-g/.virtualenvs/wtf/bin/python3
Also creating executable in /home/das-g/.virtualenvs/wtf/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
确实pip freeze --all
列出了这4个包:
pip==8.1.2
pkg-resources==0.0.0
setuptools==25.2.0
wheel==0.29.0
不过,我希望 pip freeze
(没有 --all
)忽略这些隐式安装的包。它确实省略了其中一些,但没有 pkg-resources
:
pkg-resources==0.0.0
(顺便说一句,pip freeze --local
)
虽然这与帮助文本一致
$> pip freeze --help | grep '\--all'
--all Do not skip these packages in the output: pip, setuptools, distribute, wheel
在 pip freeze
输出中包含 pkg-resources
似乎不是很有用,甚至可能有害。 (我怀疑这就是为什么 运行 pip-sync
from pip-tools 从虚拟环境中卸载 pkg-resources,从而巧妙地破坏环境。) 有什么好的理由 pip freeze
列出了 pkg-resources
而不是也省略了它? 据我记得,它没有在 Ubuntu 14.04 上列出(Python 3.4)。
根据https://github.com/pypa/pip/issues/4022, this is a bug resulting from Ubuntu providing incorrect metadata to pip. So, no there does not seem to be a good reason for this behaviour. I filed a follow-up bug with Ubuntu. https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463
我在虚拟环境中遇到了同样的问题。我用 pip uninstall pkg-resources==0.0.0
删除了它
在 Ubuntu 16.04 上使用 virtualenv 15.0.1 和 Python 3.5.2(均与 apt
一起安装)当我创建并激活新的 Python 虚拟环境时
virtualenv .virtualenvs/wtf -p $(which python3) --no-site-packages
source .virtualenvs/wtf/bin/activate
我得到以下输出:
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/das-g/.virtualenvs/wtf/bin/python3
Also creating executable in /home/das-g/.virtualenvs/wtf/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
确实pip freeze --all
列出了这4个包:
pip==8.1.2
pkg-resources==0.0.0
setuptools==25.2.0
wheel==0.29.0
不过,我希望 pip freeze
(没有 --all
)忽略这些隐式安装的包。它确实省略了其中一些,但没有 pkg-resources
:
pkg-resources==0.0.0
(顺便说一句,pip freeze --local
)
虽然这与帮助文本一致
$> pip freeze --help | grep '\--all'
--all Do not skip these packages in the output: pip, setuptools, distribute, wheel
在 pip freeze
输出中包含 pkg-resources
似乎不是很有用,甚至可能有害。 (我怀疑这就是为什么 运行 pip-sync
from pip-tools 从虚拟环境中卸载 pkg-resources,从而巧妙地破坏环境。) 有什么好的理由 pip freeze
列出了 pkg-resources
而不是也省略了它? 据我记得,它没有在 Ubuntu 14.04 上列出(Python 3.4)。
根据https://github.com/pypa/pip/issues/4022, this is a bug resulting from Ubuntu providing incorrect metadata to pip. So, no there does not seem to be a good reason for this behaviour. I filed a follow-up bug with Ubuntu. https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463
我在虚拟环境中遇到了同样的问题。我用 pip uninstall pkg-resources==0.0.0