在 jetson xavier nx 上为 python2 安装 llvmlite 和 numba 库

install llvmlite and numba library for python2 on jetson xavier nx

我想在 jetson 上为 python2 安装 numba 和 llvmlite。但是似乎没有相同的文档。一切都是为了 python3。我正在尝试 运行 ros melodic 上的程序,因此需要 python2 中的库。 当我尝试

python2.7 -m pip install numba==0.45

我收到以下错误

Collecting numba==0.45
  Downloading https://files.pythonhosted.org/packages/7e/89/853a1f03b09f1b13b59c3d785678b47daac6ddd24a285f146d09bb723b85/numba-0.45.0.tar.gz (1.8MB)
    100% |████████████████████████████████| 1.8MB 328kB/s 
Collecting llvmlite>=0.29.0dev0 (from numba==0.45)
  Using cached https://files.pythonhosted.org/packages/50/cc/04526507e80d546be5688ce0246e40277b61e7949c3347c6609b6a4154cf/llvmlite-0.32.1.tar.gz
Collecting numpy (from numba==0.45)
Collecting funcsigs (from numba==0.45)
  Using cached https://files.pythonhosted.org/packages/69/cb/f5be453359271714c01b9bd06126eaf2e368f1fddfff30818754b5ac2328/funcsigs-1.0.2-py2.py3-none-any.whl
Collecting enum34 (from numba==0.45)
  Using cached https://files.pythonhosted.org/packages/6f/2c/a9386903ece2ea85e9807e0e062174dc26fdce8b05f216d00491be29fad5/enum34-1.1.10-py2-none-any.whl
Collecting singledispatch (from numba==0.45)
  Using cached https://files.pythonhosted.org/packages/cd/d1/6a9e922826e03f5af7bf348cfb75bcb0bc4c67e19c36805c2545f34427e5/singledispatch-3.6.2-py2.py3-none-any.whl
Collecting six (from singledispatch->numba==0.45)
  Using cached https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Building wheels for collected packages: numba, llvmlite
  Running setup.py bdist_wheel for numba ... done
  Stored in directory: /home/nvidia/.cache/pip/wheels/51/5d/c0/420ea2fced22bb1702a294c2cbc0dcaefd6ed61f3d6253fd61
  Running setup.py bdist_wheel for llvmlite ... error
  Complete output from command /usr/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ni4NGO/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/tmpwjzE5mpip-wheel- --python-tag cp27:
  running bdist_wheel
  /usr/bin/python2.7 /tmp/pip-build-ni4NGO/llvmlite/ffi/build.py
    File "/tmp/pip-build-ni4NGO/llvmlite/ffi/build.py", line 122
      raise ValueError(msg.format(_ver_check_skip)) from e
                                                       ^
  SyntaxError: invalid syntax
  error: command '/usr/bin/python2.7' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for llvmlite
  Running setup.py clean for llvmlite
Successfully built numba
Failed to build llvmlite
Installing collected packages: llvmlite, numpy, funcsigs, enum34, six, singledispatch, numba
  Running setup.py install for llvmlite ... error
    Complete output from command /usr/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ni4NGO/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-XAdkTG-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    got version from file /tmp/pip-build-ni4NGO/llvmlite/llvmlite/_version.py {'version': '0.32.1', 'full': 'aa11b129c0b55973067422397821ae6d44fa5e70'}
    running build_ext
    /usr/bin/python2.7 /tmp/pip-build-ni4NGO/llvmlite/ffi/build.py
      File "/tmp/pip-build-ni4NGO/llvmlite/ffi/build.py", line 122
        raise ValueError(msg.format(_ver_check_skip)) from e
                                                         ^
    SyntaxError: invalid syntax
    error: command '/usr/bin/python2.7' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ni4NGO/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-XAdkTG-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-ni4NGO/llvmlite/

尝试升级 pip 并安装支持 Python 2.7 的最新版本:

python2.7 -m pip install -U "pip < 21.0"
python2.7 -m pip install "llvmlite < 0.32.1" "numba < 0.46"

我解决了

对我有用的是

sudo apt-get install python-numba