2013-04-27 1 views
2

Essayer d'installer python-spidermonkey en utilisant pip sur mon Mac OS, omis de le faire, car il manque nspr:Mac OS - Échec de l'installation python-spidermonkey parce nspr pas trouvé

$ pip install python-spidermonkey 
Downloading/unpacking python-spidermonkey 
    Running setup.py egg_info for package python-spidermonkey 
    Traceback (most recent call last): 
     File "<string>", line 16, in <module> 
     File "/Users/smin/ENV/build/python-spidermonkey/setup.py", line 186, in <module> 
     **platform_config() 
     File "/Users/smin/ENV/build/python-spidermonkey/setup.py", line 143, in platform_config 
     return nspr_config(config=config) 
     File "/Users/smin/ENV/build/python-spidermonkey/setup.py", line 87, in nspr_config 
     return pkg_config("nspr", config) 
     File "/Users/smin/ENV/build/python-spidermonkey/setup.py", line 59, in pkg_config 
     raise RuntimeError("No package configuration found for: %s" % pkg_name) 
    RuntimeError: No package configuration found for: nspr 
    Complete output from command python setup.py egg_info: 
    Traceback (most recent call last): 

    File "<string>", line 16, in <module> 

    File "/Users/shengjiemin/work/Ceilo-ENV/build/python-spidermonkey/setup.py", line 186, in <module> 

    **platform_config() 

    File "/Users/smin/rmonkey/setup.py", line 143, in platform_config 

    return nspr_config(config=config) 

    File "/Users/smin/ENV/build/python-spidermonkey/setup.py", line 87, in nspr_config 

    return pkg_config("nspr", config) 

    File "/Users/smin/ENV/build/python-spidermonkey/setup.py", line 59, in pkg_config 

    raise RuntimeError("No package configuration found for: %s" % pkg_name) 

RuntimeError: No package configuration found for: nspr 

---------------------------------------- 
Command python setup.py egg_info failed with error code 1 in /Users/smin/ENV/build/python-spidermonkey 

J'ai ensuite essayé d'installer nspr:

sudo port install nspr 

mais cela n'a fait aucune différence, toujours la même erreur. Des idées?

Répondre

1

Enfin je m'y suis moi-même que ce soit réglé en suivant le fil ici:

http://davisp.lighthouseapp.com/projects/26898/tickets/38-trouble-installing-on-mac-os-x-107

Deux étapes:

1.Déplacer les fichiers du dossier Darwin-XXX intérieur spidermonkey à singe araignée/libjs pour passer cette erreur.

cd /home/smin/virt-ENV/build/python-spidermonkey/spidermonkey 
mv Darwin-i386/* libjs/ 

2.Make le changement ci-dessous dans le fichier: libjs/jsutil

de:

typedef int js_static_assert_line##line[(condition) ? 1 : -1] 

à:

typedef int js_static_assert_line##line[(condition) ? 1 : 0] 
0

I trouvé une solution de contournement (la troisième ligne ci-après) pour l'installation sur MacOS 10.9.

$ brew install pkg-config 
$ brew install nspr 
$ cd /usr/local/lib/pkgconfig/ # IMPORTANT 
$ ln -s nspr.pc ../../Cellar/nspr/4.10.8_1/lib/pkgconfig/nspr.pc 

$ git clone git://github.com/davisp/python-spidermonkey.git 
$ cd python-spidermonkey 
$ cp spidermonkey/Linux-x86_64/* spidermonkey/libjs/ 
$ python setup.py build 
$ python setup.py test # test failed, but it's okay to ignore 

$ sudo python setup.py install 

Cela fonctionne très bien avec mon code python qui utilise le module spidermonkey comme ci-dessous. J'espère que cela t'aides.

rt = spidermonkey.Runtime() 
cx = rt.new_context() 
cx.execute(js) 
cx.execute("...") 
0

d'abord installer NSPR et les variables système définies:

$ brew install pkg-config 
$ brew install nspr 
$ export ARCHFLAGS="-arch x86_64" 
$ export PKG_CONFIG_PATH=/path/to/pkgconfig ## e.g. /usr/local/lib/pkgconfig 

maintenant obtenir la dernière version du code:

$ git clone git://github.com/davisp/python-spidermonkey.git 

Maintenant, exécutez les libs de mise à jour et supprimer tmp:

$ update-libjs.sh 
$ rm -r /path/to/tmp/in/spidermonkey/dir ## e.g. ./tmp 

Le fichier libjs/jsu til.h remplacer la ligne 76 de

typedef int js_static_assert_line_##line[(condition) ? 1 : -1] 

à

typedef int js_static_assert_line_##line[(condition) ? 1 : 0] 

La ligne fichier libjs/jsprf.c commentaire 644

//VARARGS_ASSIGN(nas[cn].ap, ap); 

install Maintenant, la lib

$ python setup.py build 
$ python setup.py test 
$ python setup.py install 
Questions connexes