2017-01-04 25 views
14

Không thể cài đặt mô-đun json. Theo như tôi biết tôi không nên sử dụng sudo. có chuyện gì vậy?"pip install json" không thành công trên Ubuntu

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/ 
+2

gì chưa rõ về 'tăng RuntimeError ("trọn gói 'json' phải không được tải về từ pypi") '? –

+8

Nó nên nói một cái gì đó như "gói là không cần thiết" nếu đó là những gì đang xảy ra. Nếu tôi nói rằng tôi cần phải cài đặt một gói, và trình cài đặt nói rằng tôi không thể tải xuống từ X, một giả định hợp lý là tôi cần phải tải xuống từ một nơi khác. Nhưng ở đâu? –

Trả lời

40

json là một built-in Module, bạn không cần phải cài đặt nó với pip.

+1

Đúng vậy. Tôi chưa kiểm tra trước khi đăng, tôi xin lỗi. Kiểm tra kỹ với "python import json" và nó hoạt động! – user4330326

-6

Thay vào đó, bạn có thể cài đặt simplejson.

pip install simplejson

Các vấn đề liên quan