Python命令提示符在尝试导入时消失

Python命令提示符在尝试导入时消失,python,import,command-prompt,Python,Import,Command Prompt,当试图在解释器中导入库(它是用于运行的“neuron”库)时,我只是无限期地丢失命令提示符,不会出现错误: kjb:~ ken$ python Python 2.7.8 |Anaconda 1.9.0 (x86_64)| (default, Jul 2 2014, 15:36:00) ... >>> import neuron _ 下划线表示光标 我知道这可能是神经元本身的问题,因为其他模块(如数学模块)导入时没有问题,但我想知道我应该如何继续找出问题所在?我在这里相当缺

当试图在解释器中导入库(它是用于运行的“neuron”库)时,我只是无限期地丢失命令提示符,不会出现错误:

kjb:~ ken$ python
Python 2.7.8 |Anaconda 1.9.0 (x86_64)| (default, Jul  2 2014, 15:36:00) 
...
>>> import neuron
_
下划线表示光标

我知道这可能是神经元本身的问题,因为其他模块(如数学模块)导入时没有问题,但我想知道我应该如何继续找出问题所在?我在这里相当缺乏经验


谢谢

一般来说,通过首先使用-python标志启动NEURON,将python与NEURON一起使用会更容易

nrniv -python

这从python解释器开始:

NEURON -- VERSION 7.4 (1373:f15dcfc7847b) f15dcfc7847b
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.neuron.yale.edu/neuron/credits
然后可以在其中运行python命令:

>>> import sys
>>> sys.version_info
sys.version_info(major=2, minor=7, micro=6, releaselevel='final', serial=0)
>>> quit()
更具挑战性的方法是首先启动python,然后导入NEURON库

$ python
Python 2.7.11 (default, Dec  5 2015, 14:44:47) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import neuron
NEURON -- VERSION 7.4 (1373:f15dcfc7847b) f15dcfc7847b
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.neuron.yale.edu/neuron/credits
要启动python然后导入NEURON库,您需要:

在MS Windows上,

在其他操作系统上,从源代码编译NEURON并设置NEURON python库


  • 尝试ctrl-c并查看堆栈跟踪显示的内容。然后,您可以搜索neuron+错误消息
    $ python
    Python 2.7.11 (default, Dec  5 2015, 14:44:47) 
    [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import neuron
    NEURON -- VERSION 7.4 (1373:f15dcfc7847b) f15dcfc7847b
    Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
    See http://www.neuron.yale.edu/neuron/credits
    
    pip install PyNEURON