Cannot install the json module. As far as I know I shouldn't use sudo. what's the matter?
pip install json
The directory '/home/snow/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/snow/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting json
Downloading json-99.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-YkvqVh/json/setup.py", line 2, in <module>
raise RuntimeError("Package 'json' must not be downloaded from pypi")
RuntimeError: Package 'json' must not be downloaded from pypi
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-YkvqVh/json/
json
is a built-in module, you don't need to install it withpip
.While it's true that
json
is a built-in module, I also found that on an Ubuntu system withpython-minimal
installed, you DO havepython
but you can't doimport json
. And then I understand that you would try to install the module using pip!If you have
python-minimal
you'll get a version of python with less modules than when you'd typically compile python yourself, and one of the modules you'll be missing is thejson
module. The solution is to install an additional package, calledlibpython2.7-stdlib
, to install all 'default' python libraries.And then you can do
import json
in python and it would work!