installing PyGObject via pip in virtualenv [duplicate]

浪子不回头ぞ 提交于 2019-12-12 08:24:11

问题


I'm actually upgrading an old django app from python2.7 to python3.4. While installing pygobject via pip, I got this error:

Collecting pygobject
  Using cached pygobject-2.28.3.tar.bz2
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-9dp0wn96/pygobject/setup.py", line 272
        raise SystemExit, 'ERROR: Nothing to do, gio could not be found and is essential.'
                    ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-9dp0wn96/pygobject

I am trying to install it in a virtualenv. System-wide installation doesn't work either... I am working on arch linux with python3.4

I have installed the arch package named pygobject-devel 3.16.2-1 but I still can't import gobject python module

What is this damned missing gio?

Any help is welcomed... Thanx in advance !


回答1:


ANSWER IS NOW IN THE POST TAGGED IN COMMENT ABOVE !!!! Have a look there => Python cannot install PyGObject

Ok I just managed it !

To install PyGObject in virtrualenv, give up with pip.

  1. Install PyGObject system-wide (with your package manager or compile it manually). For example, in my case :

    sudo pacman -Suy python-gobject2
    
  2. Link it in your virtualenv :

    ln -s /usr/lib/python3.4/site-packages/gobject* /WHEREVER/IS/YOUR/VIRTUALENV/venv/lib/python3.4/site-packages/
    
  3. You might need to link some other modules (in my case glib) :

    ln -s /usr/lib/python3.4/site-packages/glib* /WHEREVER/IS/YOUR/VIRTUALENV/venv/lib/python3.4/site-packages/
    

You might find some helpful infos about system-wide and virtualenv installations and interactions between modules here :

virtualenv: Specifing which packages to use system-wide vs local



来源:https://stackoverflow.com/questions/31324430/installing-pygobject-via-pip-in-virtualenv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!