PyOpenCL 无法在 Ubuntu 中构建程序

PyOpenCL can't build the program in Ubuntu

我正尝试在 Ubuntu 上通过 SSH 使用 PyOpenCL,但是当我进入 "prg = cl.Program(ctx, kernel).build()" 时,它 returns

`Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/pyopencl/__init__.py", line 141, in build
    options = options + ["-I", _find_pyopencl_include_path()]
  File "/usr/lib/python2.7/dist-packages/pyopencl/__init__.py", line 722, in _find_pyopencl_include_path
    from pkg_resources import Requirement, resource_filename
ImportError: No module named pkg_resources`

我要构建的程序是 PyOpenCL 文档 (https://documen.tician.de/pyopencl/index.html) 中的官方程序。

您只需安装 python-pkg-resources 包,它提供了名为 "pkg_resources".

的 python 包

对于其他发行版,可能需要 python 软件包的设置工具。

我遇到了你上面提到的同样的问题 n 对我有用的解决方案是我必须更新我的设置工具 pip install --upgrade setuptools 在这样做之后它起作用了...... 它对于其他一些包也很方便。