我正在关注Python GTK+ 3 Tutorial,我正在try 在virtualenv中运行一个正常的安装.我已经通过Ubuntu软件包管理器安装了python3-gi.事情是这样的:
:~$ mkvirtualenv py3 --python=/usr/bin/python3
Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in py3/bin/python3
Also creating executable in py3/bin/python
Installing setuptools, pip...python
done.
(py3):~$ python
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'gi'
>>>
(py3):~$ deactivate
:~$ /usr/bin/python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>>
正如您所见,python3 gi显然在virtualenv中不可用,但我不确定如何安装它,因为python3 gi是通过我的包管理器安装的,而不是通过pip安装的.