如何安装 Numba

问题描述 投票:0回答:1

我在安装 Numba 时遇到问题。

from numba import jit, cuda

我有 anaconda,我安装了 Numba 正在做

conda install numba

我收到以下错误

[Running] python -u "c:\Users\Eric\Desktop\github_projects\snapchat_download_and_rename\download_and_rename_41.py"
Traceback (most recent call last):
  File "c:\Users\Eric\Desktop\github_projects\snapchat_download_and_rename\download_and_rename_41.py", line 30, in <module>
    from numba import jit, cuda
ModuleNotFoundError: No module named 'numba'

现在如果我这样做了

pip install numba

我收到此错误

    PS C:\Users\Eric> pip install numba
Collecting numba
  Using cached numba-0.56.4.tar.gz (2.4 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Eric\AppData\Local\Temp\pip-install-pg8zj3ux\numba_de60e27d79d0422ea869cebdd1c269bb\setup.py", line 51, in <module>
          _guard_py_ver()
        File "C:\Users\Eric\AppData\Local\Temp\pip-install-pg8zj3ux\numba_de60e27d79d0422ea869cebdd1c269bb\setup.py", line 48, in _guard_py_ver
          raise RuntimeError(msg.format(cur_py, min_py, max_py))
      RuntimeError: Cannot install on Python version 3.11.3; only versions >=3.7,<3.11 are supported.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

[notice] A new release of pip available: 22.3.1 -> 23.1.1
[notice] To update, run: C:\Users\Eric\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip
PS C:\Users\Eric> 

之后我尝试了

pip install numba==0.57.0rc1

它安装得很好,但是当我尝试运行该程序时,我收到此错误

    [Running] python -u "c:\Users\Eric\Desktop\github_projects\snapchat_download_and_rename\download_and_rename_41.py"
Traceback (most recent call last):
  File "C:\Users\Eric\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\llvmlite\binding\ffi.py", line 180, in <module>
    lib = ctypes.CDLL(str(_lib_handle.__enter__()))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1008.0_x64__qbz5n2kfra8p0\Lib\ctypes\__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'C:\Users\Eric\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\llvmlite\binding\llvmlite.dll' (or one of its dependencies). Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\Eric\Desktop\github_projects\snapchat_download_and_rename\download_and_rename_41.py", line 30, in <module>
    from numba import jit, cuda
  File "C:\Users\Eric\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\numba\__init__.py", line 69, in <module>
    from numba.core import config
  File "C:\Users\Eric\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\numba\core\config.py", line 16, in <module>
    import llvmlite.binding as ll
  File "C:\Users\Eric\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\llvmlite\binding\__init__.py", line 4, in <module>
    from .dylib import *
  File "C:\Users\Eric\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\llvmlite\binding\dylib.py", line 3, in <module>
    from llvmlite.binding import ffi
  File "C:\Users\Eric\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\llvmlite\binding\ffi.py", line 187, in <module>
    raise OSError(msg)
OSError: Could not find/load shared object file: llvmlite.dll
 Error was: Could not find module 'C:\Users\Eric\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\llvmlite\binding\llvmlite.dll' (or one of its dependencies). Try using the full path with constructor syntax.

[Done] exited with code=1 in 0.643 seconds

我在 Visual Studio 代码中使用 python 3.11.3。任何帮助将不胜感激

python numba
1个回答
0
投票

你解决这个问题了吗?当我尝试时遇到同样的错误

pip install numba

© www.soinside.com 2019 - 2024. All rights reserved.