的Mac OS - 无法安装python-SpiderMonkey的,因为NSPR没有找到
问题描述:
尝试安装使用在我的Mac OS点子上python-SpiderMonkey的,没有这样做,因为它缺少NSPR:的Mac OS - 无法安装python-SpiderMonkey的,因为NSPR没有找到
$ 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
然后我试图安装nspr:
sudo port install nspr
但它没有任何区别,仍然是相同的错误。有任何想法吗?
答
最后我得到了这个固定由我按照这里的线程:
http://davisp.lighthouseapp.com/projects/26898/tickets/38-trouble-installing-on-mac-os-x-107
两个步骤:
1.移动从达尔文-XXX文件夹内的SpiderMonkey文件到蜘蛛猴/ libjs来解决这个错误。
cd /home/smin/virt-ENV/build/python-spidermonkey/spidermonkey
mv Darwin-i386/* libjs/
2.Make文件在下面的变化:libjs/jsutil
从:
typedef int js_static_assert_line##line[(condition) ? 1 : -1]
到:
typedef int js_static_assert_line##line[(condition) ? 1 : 0]
答
我发现一种解决方法(第三下面线)在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
这适用于我的Python代码,使用像下面的spidermonkey模块。希望这可以帮助。
rt = spidermonkey.Runtime()
cx = rt.new_context()
cx.execute(js)
cx.execute("...")
答
首先安装NSPR和设定的系统变量:
$ 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
现在得到的最新版本的代码:
$ git clone git://github.com/davisp/python-spidermonkey.git
现在运行更新的js库,并删除TMP目录:
$ update-libjs.sh
$ rm -r /path/to/tmp/in/spidermonkey/dir ## e.g. ./tmp
文件libjs/jsu til.h从
typedef int js_static_assert_line_##line[(condition) ? 1 : -1]
到
typedef int js_static_assert_line_##line[(condition) ? 1 : 0]
文件libjs/jsprf.c注释行644
//VARARGS_ASSIGN(nas[cn].ap, ap);
取代线76 现在安装的lib
$ python setup.py build
$ python setup.py test
$ python setup.py install