我刚刚在新系统上安装了Ubuntu16.04LTS。我需要在上面运行一些Python 2程序。
所以我做了以下几件事:
$ pip2
The program 'pip2' is currently not installed. You can install it by typing:
sudo apt install python-pip
$ sudo apt-get install python-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libexpat1-dev libpython-all-dev libpython-dev libpython2.7 libpython2.7-dev python-all python-all-dev python-dev python-pip-whl python-setuptools
python-wheel python2.7-dev
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
libexpat1-dev libpython-all-dev libpython-dev libpython2.7 libpython2.7-dev python-all python-all-dev python-dev python-pip python-pip-whl
python-setuptools python-wheel python2.7-dev
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 30.7 MB of archives.
After this operation, 48.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
...然后我开始使用pip2:
$ which pip2
/usr/bin/pip2
$ pip2 install --user jsonmerge
...然后失败了:
$ pip2 install --user zipp
/home/xenial/.local/lib/python2.7/site-packages/pkg_resources/py2_warn.py:22: UserWarning: Setuptools will stop working on Python 2
************************************************************
You are running Setuptools on Python 2, which is no longer
supported and
>>> SETUPTOOLS WILL STOP WORKING <<<
in a subsequent release (no sooner than 2020-04-20).
Please ensure you are installing
Setuptools using pip 9.x or later or pin to `setuptools<45`
in your environment.
If you have done those things and are still encountering
this message, please comment in
https://github.com/pypa/setuptools/issues/1458
about the steps that led to this unsupported combination.
************************************************************
sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60)
Collecting zipp
Installing collected packages: zipp
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 335, in run
prefix=options.prefix_path,
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 732, in install
**kwargs
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 837, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 1039, in move_wheel_files
isolated=self.isolated,
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 346, in move_wheel_files
assert info_dir, "%s .dist-info directory not found" % req
AssertionError: zipp .dist-info directory not found
You are using pip version 8.1.1, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.(上面的PyPi包给出了示例,我在PyPi的其他包的系统中看到了这个问题)。
我该如何正确地解决这个问题?
发布于 2020-03-14 15:52:39
我们需要遵循最后两行产出中的建议:
您使用的是pip版本8.1.1,但是有20.0.2版本可用。您应该考虑通过'pip安装-升级pip‘命令进行升级。
所以我们得跑
pip2 install --upgrade --user pip然后退出并返回登录,然后遵循其他建议:
Setuptools在您的环境中使用pip9.x或更高版本或引脚到
setuptools<45。
pip2 install --user "setuptools<45"在此之后,pip2-packages的任何安装都将产生以下消息:
弃用:Python2.7于2020年1月1日结束了它的生命。请升级Python,因为Python2.7已不再维护。未来版本的pip将放弃对Python2.7的支持。有关pip中Python2支持的更多详细信息,请参见https://pip.pypa.io/en/latest/development/release-process/#python-2-support。
https://askubuntu.com/questions/1217119
复制相似问题