how to add json library

cometta picture cometta · Sep 7, 2009 · Viewed 133.8k times · Source

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)

Answer

bluszcz picture bluszcz · Sep 7, 2009

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".