2

Mac OS で pip を使用して 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

しかし、それは何の違いもありませんでした。それでも同じエラーです。何か案は?

4

3 に答える 3

1

最後に、ここのスレッドに従って、これを自分で修正しました。

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

2 つのステップ:

1. Spidermonkey 内の Darwin-XXX フォルダから Spider monkey/libjs にファイルを移動して、このエラーを回避します。

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

2. ファイルに以下の変更を加えます。libjs/jsutil

から:

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

に:

typedef int js_static_assert_line##line[(condition) ? 1 : 0]
于 2013-05-11T15:11:00.300 に答える
0

MacOS 10.9 にインストールするための回避策 (下の 3 行目) を見つけました。

$ 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

これは、以下のように Spidermonkey モジュールを使用する私の python コードでは問題なく動作します。お役に立てれば。

rt = spidermonkey.Runtime()
cx = rt.new_context()
cx.execute(js)
cx.execute("...")
于 2014-05-07T15:07:05.197 に答える