Проблема при установке u json в Ubuntu - PullRequest
2 голосов
/ 11 февраля 2020

Я пытаюсь установить u json, что требует зависимости для установки RASA. Вызванная мною команда выглядит следующим образом:

sudo pip3 install ujson

И получено следующее сообщение об ошибке.

WARNING: The directory '/home/kamaldeep/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting ujson
  Downloading ujson-1.35.tar.gz (192 kB)
     |████████████████████████████████| 192 kB 217 kB/s 
Building wheels for collected packages: ujson
  Building wheel for ujson (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uo5b9gzb/ujson/setup.py'"'"'; _file__='"'"'/tmp/pip-install-uo5b9gzb/ujson/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, _file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-918warx5
       cwd: /tmp/pip-install-uo5b9gzb/ujson/
  Complete output (14 lines):
  Warning: 'classifiers' should be a list, got type 'filter'
  running bdist_wheel
  running build
  running build_ext
  building 'ujson' extension
  creating build
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/python
  creating build/temp.linux-x86_64-3.7/lib
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python -I./lib -I/usr/include/python3.7m -c ./python/ujson.c -o build/temp.linux-x86_64-3.7/./python/ujson.o -D_GNU_SOURCE
  In file included from ./python/ujson.c:39:0:
  ./python/py_defines.h:39:20: fatal error: Python.h: No such file or directory
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for ujson
  Running setup.py clean for ujson
Failed to build ujson
Installing collected packages: ujson
    Running setup.py install for ujson ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uo5b9gzb/ujson/setup.py'"'"'; _file__='"'"'/tmp/pip-install-uo5b9gzb/ujson/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, _file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-c2p8ewru/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/ujson
         cwd: /tmp/pip-install-uo5b9gzb/ujson/
    Complete output (14 lines):
    Warning: 'classifiers' should be a list, got type 'filter'
    running install
    running build
    running build_ext
    building 'ujson' extension
    creating build
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/python
    creating build/temp.linux-x86_64-3.7/lib
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python -I./lib -I/usr/include/python3.7m -c ./python/ujson.c -o build/temp.linux-x86_64-3.7/./python/ujson.o -D_GNU_SOURCE
    In file included from ./python/ujson.c:39:0:
    ./python/py_defines.h:39:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uo5b9gzb/ujson/setup.py'"'"'; _file__='"'"'/tmp/pip-install-uo5b9gzb/ujson/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, _file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-c2p8ewru/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/ujson Check the logs for full command output.

введите описание изображения здесь

Пожалуйста, дайте я знаю разрешение. Заранее спасибо.

Ответы [ 2 ]

0 голосов
/ 11 февраля 2020

Это супер просто!

sudo apt-get update sudo apt-get install python3-ujson

0 голосов
/ 11 февраля 2020

Вам необходимо установить пакет разработчика python, поскольку вы собираете модуль из исходного кода.

sudo aptitude install python-dev
...