pip install numba==0.48.0 报错FileNotFoundError: [Errno 2] No such file or directory: ‘llvm-config‘

pip install numba==0.48.0 报错FileNotFoundError: [Errno 2] No such file or directory: ‘llvm-config‘,第1张

报错原因和解决方案
  • numba的依赖库llvmlite-0.31.0需要llvm编译器,因此需要安装llvm
  • 对于官网已经发布的编译好的库,直接下载用即可,下载链接https://releases.llvm.org/
  • 若没有对应的平台,只能使用源码编译,源码编译需要下载对应兼容的版本,这里版本使用的是llvm-8.0.0,https://releases.llvm.org/8.0.0/llvm-8.0.0.src.tar.xz
  • 安装步骤:
tar -xvf llvm-8.0.0.src.tar.xz -C llvm
cd llvm/llvm-8.0.0.src
mkdir build
cd build 
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release \
     -DLLVM_ENABLE_RTTI=ON \
     -DLLVM_BINARY_DIR=~/llvm \ # 指定安装bin目录
     -DLLVM_MAIN_INCLUDE_DIR=~/llvm \ #指定安装include目录
     -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \ # 支持gcc-4.8.x 编译版本,若不开启,则会报错,报错信息如下
     ..
make -j8
sudo make install 
  • Host GCC version should be at least 5.1 because LLVM will soon use new C++ features which your toolchain version doesn't support. Your version is 4.8.5. You can temporarily opt out using LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN
  • 安装完成之后,则可以执行
    pip install numba==0.48.0 -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
  • 终端显示如下,完美解决。
Looking in indexes: http://mirrors.aliyun.com/pypi/simple
Collecting numba==0.48.0
  Using cached numba-0.48.0-cp39-cp39-linux_x86_64.whl
Requirement already satisfied: numpy>=1.15 in /home/xxx/miniconda3/lib/python3.9/site-packages (from numba==0.48.0) (1.21.4)
Collecting llvmlite<0.32.0,>=0.31.0dev0
  Downloading http://mirrors.aliyun.com/pypi/packages/17/fc/da81203725cb22d53e4f819374043bbfe3327831f3cb4388a3c020d7a497/llvmlite-0.31.0.tar.gz (110 kB)
     |████████████████████████████████| 110 kB 5.3 MB/s
Requirement already satisfied: setuptools in /home/xxx/miniconda3/lib/python3.9/site-packages (from numba==0.48.0) (52.0.0.post20210125)
Building wheels for collected packages: llvmlite
  Building wheel for llvmlite (setup.py) ... done
  Created wheel for llvmlite: filename=llvmlite-0.31.0-cp39-cp39-linux_x86_64.whl size=20385069 sha256=7d5ffc2c70f02751c1797277425f865ecf51db088bfae0d65602                        f8b4bba78aed
  Stored in directory: /home/xxx/.cache/pip/wheels/39/5c/8c/5ce3f4c7e62edc44fd7730160075f59321c9432d90767ef182
Successfully built llvmlite
Installing collected packages: llvmlite, numba
  Attempting uninstall: numba
    Found existing installation: numba 0.47.0
    Uninstalling numba-0.47.0:
      Successfully uninstalled numba-0.47.0
Successfully installed llvmlite-0.31.0 numba-0.48.0

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/793240.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-05
下一篇 2022-05-05

发表评论

登录后才能评论

评论列表(0条)

保存