前两天升级 ubuntu 到 18.04 LTS,但是有 3 个组件,一直停留在较低版本,用 pip install --upgrade 升级的话,会报以下错误:
Package Version Latest Type
pycairo 1.16.2 1.17.0 sdist pygobject 3.26.1 3.28.2 sdist pyxdg 0.25 0.26 wheel
错误信息:
Cannot uninstall 'pycairo'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Cannot uninstall 'pygobject'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Cannot uninstall 'pyxdg'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
请问各位有啥办法能够把以上三个组件升级到最新版本。谢谢。
1
yhx5768 2018-05-06 09:35:03 +08:00 via Android
能用就不要升 x
|
2
omph 2018-05-06 11:38:48 +08:00
sudo -H pip install pycairo --upgrade --ignore-installed pycairo
|
3
terryl OP @omph 非常感谢,顺利升级其中 2 个 package. 对于 pygobject,还需要做进一步研究。谢谢
|
4
crb912 2018-05-06 12:41:14 +08:00 via Android
18.04 默认只有 python3 了,我全新安装的。我已经放弃 python2 了,过渡到 3。楼主既然也都升级到 18.04 了,干嘛还坚守 python2 呢?
刚测试了: sudo pip3 install pygobject sudo pip3 install pyxdg |
5
terryl OP @crb912 无论是 PIP,还是 PIP3,在升级 pygobect 的时候,都会报错:
Failed building wheel for pygobject Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-6crg5hla/pygobject/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-hfxuqspt-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-6crg5hla/pygobject/ 后来发现需要安装该包:libgirepository1.0-dev 安装该包后,终于能够顺利升级上去。 |