pip升级包错误的解决方法

今天升级服务器的python依赖时报出如下错误:

  • Cannot uninstall ‘pycurl’. 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.

解决方法:

  • 使用命令
    sudo pip3/[pip2] install [package name] --ignore-installed [package name]

    安装报错的包即可解决问题

在升级pygobject时,又出现如下错误

  • Failed building wheel for pygobject

解决方法

  • 安装 libgirepository1.0-dev 和 libcairo2-dev
    • sudo apt-get install libgirepository1.0-dev libcairo2-dev
  • 然后加入 –ignore-installed 参数重新安装pygobject