terryl
V2EX  ›  Ubuntu

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

  •  
  •   terryl · May 6, 2018 · 5338 views
    This topic created in 2935 days ago, the information mentioned may be changed or developed.

    前两天升级 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 replies    2018-05-06 16:31:06 +08:00
    yhx5768
        1
    yhx5768  
       May 6, 2018 via Android
    能用就不要升 x
    omph
        2
    omph  
       May 6, 2018
    sudo -H pip install pycairo --upgrade --ignore-installed pycairo
    terryl
        3
    terryl  
    OP
       May 6, 2018 via Android
    @omph 非常感谢,顺利升级其中 2 个 package. 对于 pygobject,还需要做进一步研究。谢谢
    crb912
        4
    crb912  
       May 6, 2018 via Android
    18.04 默认只有 python3 了,我全新安装的。我已经放弃 python2 了,过渡到 3。楼主既然也都升级到 18.04 了,干嘛还坚守 python2 呢?
    刚测试了:
    sudo pip3 install pygobject
    sudo pip3 install pyxdg
    terryl
        5
    terryl  
    OP
       May 6, 2018
    @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

    安装该包后,终于能够顺利升级上去。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5325 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 55ms · UTC 05:51 · PVG 13:51 · LAX 22:51 · JFK 01:51
    ♥ Do have faith in what you're doing.