Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x Python3.8无法安装shap、llvmlite或numba_Python 3.x_Linux_Ubuntu_Pip_Llvm - Fatal编程技术网

Python 3.x Python3.8无法安装shap、llvmlite或numba

Python 3.x Python3.8无法安装shap、llvmlite或numba,python-3.x,linux,ubuntu,pip,llvm,Python 3.x,Linux,Ubuntu,Pip,Llvm,我正在尝试安装快照: sudo-H python3.8-m pip安装shap 但这会产生 Warning: Can't read registry to find the necessary compiler setting Make sure that Python modules winreg, win32api or win32con are installed. C compiler: x86_64-linux-gnu-gcc -pthread -Wno-unused-re

我正在尝试安装快照:

sudo-H python3.8-m pip安装shap

但这会产生

  Warning: Can't read registry to find the necessary compiler setting
  Make sure that Python modules winreg, win32api or win32con are installed.
  C compiler: 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 -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC
  
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/numba
  compile options: '-I/usr/include/python3.8 -c'
  x86_64-linux-gnu-gcc: numba/_dynfuncmod.c
  In file included from numba/_dynfunc.c:6:0,
                   from numba/_dynfuncmod.c:1:
  numba/_pymodule.h:6:10: fatal error: Python.h: No such file or directory
   #include <Python.h>
            ^~~~~~~~~~
  compilation terminated.
  error: Command "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 -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c numba/_dynfuncmod.c -o build/temp.linux-x86_64-3.8/numba/_dynfuncmod.o" failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for numba
  Running setup.py clean for numba
  Running setup.py bdist_wheel for llvmlite ... error
  Complete output from command /usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-g2j9vqik/llvmlite/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/tmpeqdilkydpip-wheel- --python-tag cp38:
  running bdist_wheel
  /usr/bin/python3.8 /tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py
  LLVM version... Traceback (most recent call last):
    File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 105, in main_posix
      out = subprocess.check_output([llvm_config, '--version'])
    File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
      return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    File "/usr/lib/python3.8/subprocess.py", line 489, in run
      with Popen(*popenargs, **kwargs) as process:
    File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
      self._execute_child(args, executable, preexec_fn, close_fds,
    File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: 'llvm-config'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 191, in <module>
      main()
    File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 181, in main
      main_posix('linux', '.so')
    File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 107, in main_posix
      raise RuntimeError("%s failed executing, please point LLVM_CONFIG "
  RuntimeError: llvm-config failed executing, please point LLVM_CONFIG to the path for llvm-config
  error: command '/usr/bin/python3.8' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for llvmlite
  Running setup.py clean for llvmlite
Failed to build shap numba llvmlite
Installing collected packages: llvmlite, numba, python-dateutil, pandas, slicer, tqdm, shap
  Running setup.py install for llvmlite ... error
    Complete output from command /usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-g2j9vqik/llvmlite/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-o_ke5g0q-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    got version from file /tmp/pip-build-g2j9vqik/llvmlite/llvmlite/_version.py {'version': '0.35.0', 'full': 'ea23b026930cc00824c907172383f54c9d438e6b'}
    running build_ext
    /usr/bin/python3.8 /tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py
    LLVM version... Traceback (most recent call last):
      File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 105, in main_posix
        out = subprocess.check_output([llvm_config, '--version'])
      File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
        return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
      File "/usr/lib/python3.8/subprocess.py", line 489, in run
        with Popen(*popenargs, **kwargs) as process:
      File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'llvm-config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 191, in <module>
        main()
      File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 181, in main
        main_posix('linux', '.so')
      File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 107, in main_posix
        raise RuntimeError("%s failed executing, please point LLVM_CONFIG "
    RuntimeError: llvm-config failed executing, please point LLVM_CONFIG to the path for llvm-config
    error: command '/usr/bin/python3.8' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-g2j9vqik/llvmlite/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-o_ke5g0q-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-g2j9vqik/llvmlite/

我如何修改我的系统来安装
shap

这里的问题是,有这么多的库和这么多可能不兼容的版本,这是一个完全混乱的局面

解决方案:

  • sudo-H python3.8-m pip安装--升级pip-wheel设置工具

  • sudo-H python3.8-m pip安装colorama--升级

  • sudo-H python3.8-m pip安装shap


  • 这个解决方案之所以不那么明显,是因为错误消息中没有提到这一点。

    Python.h
    是Ubuntu中
    libpython3 dev
    的一部分。我的系统说
    libpython3 dev已经是最新版本(3.6.7-1~18.04)。
    你的
    libpython3 dev
    是针对python3.6的,您运行了
    python3.8-mpip
    @phd我已经安装了
    libpython3.8-dev
    llvm-9-dev
    ,但是
    shap
    安装仍然失败,并显示类似的错误消息
    con@V:~/Scripts/python3$ sudo -H python3.8 -m pip install --upgrade pip --no-cache-dir
    Requirement already satisfied: pip in /usr/local/lib/python3.8/dist-packages (21.0.1)