python No module named ujson, while it's already installed

Amjad Omari picture Amjad Omari · May 23, 2016 · Viewed 12.1k times · Source

I've installed ujson using command pip install ujson and when I've tried to run my python project it returns ImportError: No module named ujson

  • OS version: Red Hat Enterprise Linux Server release 7.2 (Maipo)
  • Python version: Python 2.7.6
  • pip list: ujson (1.35)

Any help please?

Answer

Amjad Omari picture Amjad Omari · May 23, 2016

The problem was that the PYTHONPATH variable is empty, and when I added the path to the variable it works.

export PYTHONPATH=$PYTHONPATH:/usr/lib64/python2.7/site-packages