2

我正在尝试安装 ujson,这是安装 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.

在此处输入图像描述

请让我知道解决方案。提前致谢。

4

2 回答 2

0

超级简单!

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

于 2020-02-11T16:31:18.950 回答
0

您需要安装 python 开发人员包,因为您是从源代码构建模块。

sudo aptitude install python-dev
于 2020-02-11T15:48:29.437 回答