Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install gtk in python2.7?

Tags:

python

gtk

I'm using Debian 6.04 and Python 2.7
I compiled Python 2.7 ,(./configure,make,make install)
in the console:

>python2.7  
Python 2.7.3 (default, Jul 28 2012, 16:54:06) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named gtk

How do I install gtk in Python 2.7?

In Python 2.6:

tiger@debian:~$ python
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtk
>>> import pygtk
>>> import gobject
like image 740
Peng Peng Avatar asked Jul 28 '12 09:07

Peng Peng


People also ask

Can I use GTK with python?

GTK and Python It supports Linux, Windows and macOS and works with Python 2.7+, Python 3.5+, PyPy and PyPy3.

Does python2 have PIP?

PIP is automatically installed with Python 2.7.9+ and Python 3.4+ and it comes with the virtualenv and pyvenv virtual environments. Before you install PIP on Windows, check if PIP is already installed.

How to build a GTK3 application in Python?

(optional): If you want to develop a GTK3 application in Python, you need to install the Python bindings. If you develop in Python 3: pacman -S mingw-w64-x86_64-python3-gobject If you develop in Python 2: pacman -S mingw-w64-x86_64-python2-gobject Step 5. (optional): Install the build tools.

How do I install GTK on Windows?

On Windows, GTK applications are typically bundled with GTK already, so end-users do not need to worry about how to install GTK itself. There are various methods to install GTK on Windows development machines. ... Install GTK3 and its dependencies. Open a MSYS2 shell, and run: pacman -S mingw-w64-x86_64-gtk3 Step 3.

What version of GTK+ does it support?

It exclusively supports GTK+ version 3 or later. 1.1. Dependencies ¶ Python 2 (2.6 or later) or Python 3 (3.1 or later) 1.2. Prebuilt Packages ¶

How to install GTK3 on MSYS2?

: Install GTK3 and its dependencies. Open a MSYS2 shell, and run: pacman -S mingw-w64-x86_64-gtk3 Step 3. (recommended): Install the GTK core applications. Gladeis a GUI designer for GTK. It lets you design your GUI and export it in XML format. You can then import your GUI from your code using the GtkBuilder API.


1 Answers

Try installing it using pip/python-pip/easy_install. On Fedora I installed it like this:

sudo pip install PyGTK
like image 126
Michal Avatar answered Oct 12 '22 23:10

Michal