2

遵循 Nest 模拟器的Ubuntu/Debian 安装说明后,我只能在 python2.x 中导入 nest 模块,而不是 python3.x

$ python3
Python 3.6.8 (default, Aug 20 2019, 17:12:48) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nest
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nest/lib/python2.7/site-packages/nest/__init__.py", line 26, in <module>
    from . import ll_api      # noqa
  File "/nest/lib/python2.7/site-packages/nest/ll_api.py", line 72, in <module>
    from . import pynestkernel as kernel      # noqa
ImportError: dynamic module does not define module export function (PyInit_pynestkernel)
4

1 回答 1

2

默认安装使用默认的 Python 版本编译,在 Ubuntu 中仍为 2。要使用 Python 3,请运行:

cmake -Dwith-python=3 -DCMAKE_INSTALL_PREFIX:PATH=</install/path> </path/to/NEST/src>

在文档中提到这里。

注意:不要忘记清除构建文件夹以避免出现问题

于 2019-09-12T15:25:13.447 回答