das*_*s-g 34 python pip virtualenv python-3.5 ubuntu-16.04
在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
Run Code Online (Sandbox Code Playgroud)
我得到以下输出:
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.
Run Code Online (Sandbox Code Playgroud)
确实pip freeze --all列出了这4个包:
pip==8.1.2
pkg-resources==0.0.0
setuptools==25.2.0
wheel==0.29.0
Run Code Online (Sandbox Code Playgroud)
虽然,我希望pip freeze(没有--all)省略这些隐式安装的软件包.它确实省略了其中一些,但没有pkg-resources:
pkg-resources==0.0.0
Run Code Online (Sandbox Code Playgroud)
(同btw.pip freeze --local)
虽然这与帮助文本一致
$> pip freeze --help | grep '\--all'
--all Do not skip these packages in the output: pip, setuptools, distribute, wheel
Run Code Online (Sandbox Code Playgroud)
其pkg-resources在pip freeze输出似乎并不非常有用,甚至可能是有害的.(我怀疑这就是为什么pip-sync从pip-tools运行从虚拟环境中卸载pkg-resources,从而巧妙地破坏环境.)有没有什么好的理由可以pip freeze列出列表pkg-resources而不是省略它?据我所知,它没有在Ubuntu 14.04(使用Python 3.4)上列出.
Cra*_*ght 20
根据https://github.com/pypa/pip/issues/4022,这是由Ubuntu提供错误元数据到pip的错误.所以,似乎没有这种行为的充分理由.我向Ubuntu提交了一个后续错误.https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463
我在我的虚拟环境中遇到了同样的问题。我删除了它pip uninstall pkg-resources==0.0.0