cometta
cometta

Reputation: 35689

how to add json library

i am new to python, on my Mac, when i issue command

User:ihasfriendz user$ python main.py
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import json
ImportError: No module named json

I get error on json. how to add this library? i'm using 2.5 (the default came with leopard)

Upvotes: 20

Views: 182587

Answers (3)

bluszcz
bluszcz

Reputation: 4128

You can also install simplejson.

If you have pip (see https://pypi.python.org/pypi/pip) as your Python package manager you can install simplejson with:

 pip install simplejson

This is similar to the comment of installing with easy_install, but I prefer pip to easy_install as you can easily uninstall in pip with "pip uninstall package".

Upvotes: 32

Andrew Walker
Andrew Walker

Reputation: 42470

You can also install json-py from here http://sourceforge.net/projects/json-py/

Upvotes: 2

Hole
Hole

Reputation: 89

AFAIK the json module was added in version 2.6, see here. I'm guessing you can update your python installation to the latest stable 2.6 from this page.

Upvotes: 7

Related Questions