V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
terryl
V2EX  ›  Ubuntu

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

  •  
  •   terryl · 2018-05-06 09:05:57 +08:00 · 4820 次点击
    这是一个创建于 2398 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

    5 条回复    2018-05-06 16:31:06 +08:00
    yhx5768
        1
    yhx5768  
       2018-05-06 09:35:03 +08:00 via Android
    能用就不要升 x
    omph
        2
    omph  
       2018-05-06 11:38:48 +08:00
    sudo -H pip install pycairo --upgrade --ignore-installed pycairo
    terryl
        3
    terryl  
    OP
       2018-05-06 12:00:17 +08:00 via Android
    @omph 非常感谢,顺利升级其中 2 个 package. 对于 pygobject,还需要做进一步研究。谢谢
    crb912
        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
    terryl
        5
    terryl  
    OP
       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

    安装该包后,终于能够顺利升级上去。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3379 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 00:42 · PVG 08:42 · LAX 16:42 · JFK 19:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.