如何在Ubuntu 18.04上的Python3中安装Nest

时间:2019-09-12 15:21:26

标签: python-3.x

按照Ubuntu/Debian installation instructions使用Nest模拟器后,我只能在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)

1 个答案:

答案 0 :(得分:2)

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

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

在文档中提到的here

NB:别忘了清除构建文件夹以避免出现问题