0

I received a piece of Python code which runs alright on Mac machines. I had to install Python on my Windows machine from scratch and when I try to run the code I get this error: File "x.py", line 7, in import ujson ImportError: No module named ujson

Now, I know that I have to install some library named ujson which will help me communicate with JSON files, but I cannot seem yo find the installer for it.

Please help!!

leppie
  • 115,091
  • 17
  • 196
  • 297
SZA
  • 71
  • 2
  • 2
  • 3
  • https://pypi.python.org/pypi/ujson – Uncle Long Hair Jan 23 '15 at 19:28
  • I saw this and I installed the first installer I saw for windows but when I try to install it, it asks for Python 2.7 to be installed. I have Python 2.7.9 installed on my machine so the installer does not let me go any farther than that – SZA Jan 23 '15 at 19:30
  • use python setuptools ... then `pip install ujson` will probably work ... you can probably just change that line to `import json as ujson` it will probably just be a little slower – Joran Beasley Jan 23 '15 at 19:42
  • 1) does pip install ujson work for Windows? – SZA Jan 23 '15 at 19:45
  • 2) there is already an import json in the script and I have tried to comment out import ujson to see if that works but it doesnt – SZA Jan 23 '15 at 19:45
  • Well, Python 2.7.9 includes pip (https://www.python.org/downloads/release/python-279/), so just do a `pip.exe install ujson`. If that doesn't work, download and untar the source, and in the folder in which you untarred it, do a `python setup.py install`. –  Jan 23 '15 at 19:50
  • Incidentally, writing code in anything that isn't Windows-only on a Windows machine can be a level of hell unto itself. If you can, consider setting up a VM with a linux distribution, and code on that. –  Jan 23 '15 at 19:51
  • Disagree Jack: python makes a decent attempt at being truly cross-platform. Problems arise from compilers and drivers... but for most uses that isn't required. Most important is to start from a good distribution (winpython, anaconda) rather than installing things piecemeal. – mdurant Jan 23 '15 at 20:02
  • I did both pip.exe install ujson and python setup.py install and I get this error: Syntax Error: invalid syntax – SZA Jan 24 '15 at 19:45

0 Answers0