macos Mac OS X 的 PyGTK 在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1164949/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 06:17:20  来源:igfitidea点击:

Where is PyGTK for Mac OS X?

macospygtk

提问by Ronaldo Nascimento

Is there a binary out there for the current mac os x, python for PyGTK? I work with multiple desktop environments (mac, windows, gnome) and really consider python's lack of cross platform GUI's a problem. Does anyone know where I can find a built version of PyGTK and GTK for Mac? I cant clone the git repository, it keeps timing out.

是否有适用于当前 mac os x 的二进制文件,PyGTK 的 python?我在多个桌面环境(mac、windows、gnome)中工作,并且真的认为 python 缺乏跨平台 GUI 是一个问题。有谁知道我在哪里可以找到适用于 Mac 的 PyGTK 和 GTK 的构建版本?我无法克隆 git 存储库,它总是超时。

采纳答案by b3rx

I don't use macports but it seems that jhbuild works for me. Below is the steps that I've done.

我不使用 macports,但似乎 jhbuild 对我有用。下面是我已经完成的步骤。

  1. download gtk-osx-build-setup.sh from: https://raw.github.com/jralls/gtk-osx-build/master/gtk-osx-build-setup.shand save it to your home directory.
  2. fire up terminal and navigate to your home directory and run the command sh gtk-osx-build-setup.sh
  3. the shell script will warn you that ~/.local/binisn't added to your environment variable to do this, edit your .profilefile located at your home directory and /Users/<username>/.local/binto your environment variable. to know more on how to edit this file check out: http://www.tech-recipes.com/rx/2621/os_x_change_path_environment_variable/
  4. after that, do a ~/.local/bin/jhbuild bootstrapcommand. it will download and install some necessary utilities.
  5. download and install the beta version of the gtk+ osx framework at: http://ftp.imendio.com/pub/imendio/gtk-osx/Gtk-Framework-2.14-LATEST.dmg
  6. before installing the meta-gtk-osx-python, you need to build and install some other packages that jhbuilddoesn't install automatically, so what i did was i installed libpngby doing the command: ~/.local/bin/jhbuild build libpng
  7. you also need to install libtiffso do the command: ~/.local/bin/jhbuild build libtiff
  8. and also gtk-docis needed so: ~/.local/bin/jhbuild build gtk-doc
  9. and finally you can now install meta-gtk-osx-pythonby doing a: ~/.local/bin/jhbuild build meta-gtk-osx-python
  1. 从以下位置下载 gtk-osx-build-setup.sh:https://raw.github.com/jralls/gtk-osx-build/master/gtk-osx-build-setup.sh并将其保存到您的主目录。
  2. 启动终端并导航到您的主目录并运行命令 sh gtk-osx-build-setup.sh
  3. shell 脚本会警告您~/.local/bin未添加到您的环境变量中以执行此操作,请编辑.profile位于您的主目录和/Users/<username>/.local/bin环境变量中的文件。要了解有关如何编辑此文件的更多信息,请查看:http://www.tech-recipes.com/rx/2621/os_x_change_path_environment_variable/
  4. 之后,执行~/.local/bin/jhbuild bootstrap命令。它将下载并安装一些必要的实用程序。
  5. 在以下位置下载并安装 gtk+ osx 框架的测试版: http://ftp.imendio.com/pub/imendio/gtk-osx/Gtk-Framework-2.14-LATEST.dmg
  6. 在安装之前meta-gtk-osx-python,您需要构建并安装一些jhbuild不会自动安装的其他软件包,所以我所做的是libpng通过执行以下命令进行安装:~/.local/bin/jhbuild build libpng
  7. 您还需要安装,libtiff所以执行以下命令:~/.local/bin/jhbuild build libtiff
  8. 并且也gtk-doc需要这样:~/.local/bin/jhbuild build gtk-doc
  9. 最后,您现在可以meta-gtk-osx-python通过执行以下操作进行安装:~/.local/bin/jhbuild build meta-gtk-osx-python

Let me know if it works.

让我知道它是否有效。

回答by chelmertz

brew install pygtkworked for me (requires homebrew).

brew install pygtk对我来说有效(需要自制软件)。

Confirmed to work with OS X 10.10 too, but by default it will install it into brew's Python distribution, so if you are still using the native python, it will not find it.

确认也可以与 OS X 10.10 一起使用,但默认情况下它会将其安装到 brew 的 Python 发行版中,因此如果您仍在使用本机 python,它将找不到它。

回答by CharlesB

There is an installer for PyGTK 2.24 in test here, announcedon the PyGTK list.

这里有一个 PyGTK 2.24 的安装程序正在测试中, 在 PyGTK 列表中公布

UPDATE project has moved on macpkg's sourceforge page.

更新项目已在macpkg 的 sourceforge 页面上移动。

I couldn't make it work with meld(segmentation fault), but sample PyGTK programs work OK.

我无法让它与meld(分段错误)一起工作,但示例 PyGTK 程序工作正常。

UPDATE 2 since then a new package Py3GTK3appeared on the same sourceforge page. Haven't tested though.

更新 2 从那时起一个新的包Py3GTK3出现在同一个 sourceforge 页面上。不过还没测试。

回答by andy boot

There is now a mac package on sourceforge

sourceforge上现在有一个mac包

回答by bschlueter

Download the latest package from http://sourceforge.net/projects/macpkg/files/PyGTK/and install.

http://sourceforge.net/projects/macpkg/files/PyGTK/下载最新的包并安装。

If you're just trying to use the system python, this is all you'll have to do.

如果你只是想使用系统 python,这就是你所要做的。

If you're not, the following is how to install it with pyenv, which can be installed with Homebrew. With brew installed, you can install version pyenv and Python 2.7.8 with:

如果你不是,下面是如何用pyenv安装它,它可以用Homebrew安装。安装 brew 后,您可以使用以下命令安装 pyenv 和 Python 2.7.8 版本:

brew install pyenv && pyenv install 2.7.8

After you've done that, you'll then have copy the gtk package and its dependencies into your python installation:

完成后,您将 gtk 包及其依赖项复制到您的 python 安装中:

cd /opt/gtk/lib/python2.7/site-packages/ && \
cp * ~/.pyenv/versions/2.7.8/lib/python2.7/site-packages/

That's it. You can also similarly install the Py3GTK3 package which has packages for python 2.7 and 3.2 from http://sourceforge.net/projects/macpkg/files/Py3GTK3/.

而已。您也可以类似地从http://sourceforge.net/projects/macpkg/files/Py3GTK3/安装 Py3GTK3 包,该包具有 python 2.7 和 3.2 的包。

回答by Sneakyness

Have you tried doing it using macports? This website shows how.

您是否尝试过使用 macports 进行操作?这个网站展示了如何