pygtk 在 Focal Fossa (20.04) 上不可用?

Alf*_*lfe 9 pygtk python-2.7 python3 20.04

tl;dr 我不能再安装pygtk在 Focal Fossa (Ubuntu 20.04) 上,但我自己编写的基于 PyGTK 的 Python 应用程序需要它。

几年前,我使用该pygtk包基于 GTK 编写了一个 Python2 应用程序。这多年来一直很好用,我总是可以使用可用的 Python2 安装,即使 Python3 是更现代的变体。

随着 Focal Fossa (Ubuntu 20.04) 对 Python2 的支持已被删除,所以我想,没问题,我可以将我的应用程序升级到 Python3。完成后,我尝试pygtk使用 Python3 进行安装,sudo pip3 install pygtk但这失败了:

$ sudo pip3 install pygtk
Collecting pygtk
  Using cached pygtk-2.24.0.tar.bz2 (2.4 MB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nezwkvr_/pygtk/setup.py'"'"'; __file__='"'"'/tmp/pip-install-nezwkvr_/pygtk/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-nezwkvr_/pygtk/pip-egg-info
         cwd: /tmp/pip-install-nezwkvr_/pygtk/
    Complete output (4 lines):
    ********************************************************************
    * Building PyGTK using distutils is only supported on windows. *
    * To build PyGTK in a supported way, read the INSTALL file.    *
    ********************************************************************
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Run Code Online (Sandbox Code Playgroud)

(提到的pygtk-2.24.0.tar.bz2文件再也找不到了,所以我什至无法INSTALL按照建议查看该文件。)

我还发现没有apt install ...安装它的软件包。

好吧,我想,回到 Python2。但不幸的是,我也无法pygtk为 Python2安装。我可以安装一个python2包,但是pipPython2 不再有命令和/或模块了。(因此,不管pip ...也不是pip2 ...,也没有python2 -m pip工作。也许我只是没有找到正确的方式来做到这一点。)

所以我也无法安装 Python2 版本。

然后我简短地尝试查找如何安装 pygtk 的非打包版本,但很快就深入研究了更多依赖项(jhinstall等),这似乎需要更多时间,而且我缺乏解决所有这些问题的经验。

所以我猜也许有一个更简单的解决方案,也许这里有人知道如何轻松解决这个问题。如果这里没有任何东西弹出,我将不得不投入时间并以艰难的方式解决依赖关系。

N0r*_*ert 17

您可以python-gtk2从 18.04 LTS 存储库手动安装:

cd ~/Downloads
wget http://archive.ubuntu.com/ubuntu/pool/universe/p/pygtk/python-gtk2_2.24.0-5.1ubuntu2_amd64.deb
sudo apt-get install ./python-gtk2_2.24.0-5.1ubuntu2_amd64.deb
Run Code Online (Sandbox Code Playgroud)

并像往常一样使用它:)

  • 我会考虑使用它,但我更喜欢使用来自官方来源的官方软件包。 (4认同)