I'm following the Python GTK+ 3 Tutorial and I'm trying to get a working install running in virtualenv. I have python3-gi installed through the Ubuntu package manager already. Things look like this:
:~$ 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 >>>
As you can see, python3-gi is obviously not available within virtualenv but I am not sure how to install it since python3-gi is installed through my package manager and not with pip.
virtualenv is used to manage Python packages for different projects. Using virtualenv allows you to avoid installing Python packages globally which could break system tools or other projects. You can install virtualenv using pip.
By default, that will be the version of python that is used for any new environment you create. However, you can specify any version of python installed on your computer to use inside a new environment with the -p flag : $ virtualenv -p python3. 2 my_env Running virtualenv with interpreter /usr/local/bin/python3.
In the csh shell − type setenv PATH "$PATH:/usr/local/bin/python3" and press Enter. In the bash shell (Linux) − type export PYTHONPATH=/usr/local/bin/python3. 4 and press Enter. In the sh or ksh shell − type PATH = "$PATH:/usr/local/bin/python3" and press Enter.
It is now possible to resolve this using vext. Vext allows you to install packages in a virtualenv that individually access your system packages. To access gi
, do the following:
pip install vext pip install vext.gi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With