2017-02-21 3 views
1

J'essaie d'obtenir pygobject installé, mais l'une des dépendances est py3cairo. Je l'ai déjà installé pour Python 3.4, mais maintenant je veux l'utiliser avec Python 3.6.Installez py3cairo pour Python 3.6

Je sais que je peux l'installer avec sudo apt-get install python3-cairo, mais il dit qu'il est déjà installé:

$ sudo apt-get install python3-cairo 
Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
python3-cairo is already the newest version. 
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 

Cependant,

Python 3.6.0 (default, Feb 20 2017, 17:34:58) 
[GCC 4.9.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> 
ModuleNotFoundError: No module named 'gi' 
>>> import cairo 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
ModuleNotFoundError: No module named 'cairo' 
>>> quit() 
[email protected]:~/Downloads$ python3.4 
Python 3.4.2 (default, Oct 8 2014, 10:45:20) 
[GCC 4.9.1] on linux 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import gi 
>>> import cairo 

tente de construire/installer de la source est laide, depuis que je reçois tous les types des questions:

$ PYTHON="python3.6" ./waf configure 
    ./options() 
Setting top to       : /home/brandon/Downloads/pycairo-1.10.0 
Setting out to       : /home/brandon/Downloads/pycairo-1.10.0/build_directory 
    ./configure() 
Checking for 'gcc' (c compiler)   : ok 
Checking for program python    : python3.6 
python executable 'python3.6' different from sys.executable '/usr/local/bin/python3.6' 
Checking for python version    : (3, 6, 0, 'final', 0) 
Traceback (most recent call last): 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Scripting.py", line 93, in waf_entry_point 
    run_commands() 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Scripting.py", line 145, in run_commands 
    run_command(cmd_name) 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Scripting.py", line 138, in run_command 
    ctx.execute() 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Configure.py", line 124, in execute 
    super(ConfigurationContext,self).execute() 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Context.py", line 87, in execute 
    self.recurse([os.path.dirname(g_module.root_path)]) 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Context.py", line 127, in recurse 
    user_function(self) 
    File "/home/brandon/Downloads/pycairo-1.10.0/wscript", line 29, in configure 
    ctx.check_python_headers() 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Configure.py", line 217, in fun 
    return f(*k,**kw) 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Tools/python.py", line 146, in check_python_headers 
    result=conf.check(lib=name,uselib='PYEMBED',libpath=path,mandatory=False,msg='Checking for library %s in LIBDIR'%name) 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Configure.py", line 217, in fun 
    return f(*k,**kw) 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Tools/c_config.py", line 357, in check 
    ret=self.run_c_code(*k,**kw) 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Configure.py", line 217, in fun 
    return f(*k,**kw) 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Tools/c_config.py", line 435, in run_c_code 
    bld.compile() 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Build.py", line 190, in compile 
    self.store() 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Utils.py", line 300, in f 
    ret=fun(*k,**kw) 
    File "/home/brandon/Downloads/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Build.py", line 164, in store 
    cPickle.dump(data,f) 
AttributeError: Can't pickle local object 'Context.__init__.<locals>.node_class' 
Checking for library python3.6 in LIBDIR : 

Comment puis-je installer py3cairo et surmonter ces problèmes?

Répondre

1

J'essaie de faire la même chose, compiler pycairo avec python3.6, sur Slackware 14.2. Je reçois la même erreur que vous, et aucun des différents patches waf mentionnés n'a fonctionné non plus.

J'ai fait un progrès dans cette poursuite. La distribution slackware-current a un script waf qui semble fonctionner. L'erreur ci-dessus que vous avez mentionnée est absente de ce script, mais une autre erreur apparaît quand il tente de compiler avec une erreur dans cairomodule.c.

La construction slackware-current est presque terminée, mais échoue toujours avec une erreur de compilation. Peut-être que quelqu'un avec plus d'expérience avec les libs peut le réparer.

+0

Ceci est utile, je vais essayer et voir ce qui se passe. – bjd2385