python 2.7 – pip install json fails on Ubuntu
python 2.7 – pip install json fails on Ubuntu
json
is a built-in module, you dont need to install it with pip
.
While its true that json
is a built-in module, I also found that on an Ubuntu system with python-minimal
installed, you DO have python
but you cant do import json
. And then I understand that you would try to install the module using pip!
If you have python-minimal
youll get a version of python with less modules than when youd typically compile python yourself, and one of the modules youll be missing is the json
module. The solution is to install an additional package, called libpython2.7-stdlib
, to install all default python libraries.
sudo apt install libpython2.7-stdlib
And then you can do import json
in python and it would work!