ubuntu 小白,对于 package 升级的问题

2018-05-06 09:05:57 +08:00
 terryl

前两天升级 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.

请问各位有啥办法能够把以上三个组件升级到最新版本。谢谢。

4802 次点击
所在节点    Ubuntu
5 条回复
yhx5768
2018-05-06 09:35:03 +08:00
能用就不要升 x
omph
2018-05-06 11:38:48 +08:00
sudo -H pip install pycairo --upgrade --ignore-installed pycairo
terryl
2018-05-06 12:00:17 +08:00
@omph 非常感谢,顺利升级其中 2 个 package. 对于 pygobject,还需要做进一步研究。谢谢
crb912
2018-05-06 12:41:14 +08:00
18.04 默认只有 python3 了,我全新安装的。我已经放弃 python2 了,过渡到 3。楼主既然也都升级到 18.04 了,干嘛还坚守 python2 呢?
刚测试了:
sudo pip3 install pygobject
sudo pip3 install pyxdg
terryl
2018-05-06 16:31:06 +08:00
@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

安装该包后,终于能够顺利升级上去。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/452468

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX