0

我正在拼命地让 ipython notebook 在 Windows 环境中工作。我安装了 Continuum IO 的 Anaconda,一个科学的 Python 发行版。我想使用 ipython notebook,但得到以下错误。 ipython在终端工作正常。有什么想法吗?

更新:如下所述,这是我系统上 sys.path 的输出。

['',
 'C:\\Anaconda\\scripts',
 'C:\\Anaconda\\lib\\site-packages\\distribute-0.6.45-py2.7.egg',
 'C:\\Anaconda',
 'C:\\Users\\btibert\\ C:\\Anaconda\\Scripts',
 'C:\\Anaconda\\python27.zip',
 'C:\\Anaconda\\DLLs',
 'C:\\Anaconda\\lib',
 'C:\\Anaconda\\lib\\plat-win',
 'C:\\Anaconda\\lib\\lib-tk',
 'C:\\Users\\btibert\\AppData\\Roaming\\Python\\Python27\\site-packages',
 'C:\\Users\\btibert\\AppData\\Roaming\\Python\\Python27\\site-packages\\Orange\\orng',
 'C:\\Users\\btibert\\AppData\\Roaming\\Python\\Python27\\site-packages\\setuptools-0.6c11-py2.7.egg-info',
 'C:\\Anaconda\\lib\\site-packages',
 'C:\\Anaconda\\lib\\site-packages\\PIL',
 'C:\\Anaconda\\lib\\site-packages\\win32',
 'C:\\Anaconda\\lib\\site-packages\\win32\\lib',
 'C:\\Anaconda\\lib\\site-packages\\Pythonwin',
 'C:\\Users\\btibert\\AppData\\Roaming\\Python\\Python27\\site-packages\\IPython\\extensions']

这是错误:

C:\Users\btibert>ipython notebook
Traceback (most recent call last):
  File "C:\Anaconda\Scripts\ipython-script.py", line 5, in <module>
    sys.exit(launch_new_instance())
  File "C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\IPython\frontend\terminal\ipapp.py", line 402, in
 launch_new_instance
    app.initialize()
  File "<string>", line 2, in initialize
  File "C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\IPython\config\application.py", line 84, in catch
_config_error
    return method(app, *args, **kwargs)
  File "C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\IPython\frontend\terminal\ipapp.py", line 302, in
 initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<string>", line 2, in initialize
  File "C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\IPython\config\application.py", line 84, in catch
_config_error
    return method(app, *args, **kwargs)
  File "C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\IPython\core\application.py", line 325, in initia
lize
    self.parse_command_line(argv)
  File "C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\IPython\frontend\terminal\ipapp.py", line 297, in
 parse_command_line
    return super(TerminalIPythonApp, self).parse_command_line(argv)
  File "<string>", line 2, in parse_command_line
  File "C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\IPython\config\application.py", line 84, in catch
_config_error
    return method(app, *args, **kwargs)
  File "C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\IPython\config\application.py", line 413, in pars
e_command_line
    return self.initialize_subcommand(subc, subargv)
  File "<string>", line 2, in initialize_subcommand
  File "C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\IPython\config\application.py", line 84, in catch
_config_error
    return method(app, *args, **kwargs)
  File "C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\IPython\config\application.py", line 349, in init
ialize_subcommand
    subapp = import_item(subapp)
  File "C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\IPython\utils\importstring.py", line 40, in impor
t_item
    module = __import__(package,fromlist=[obj])
  File "C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\IPython\frontend\html\notebook\notebookapp.py", l
ine 34, in <module>
    from zmq.eventloop import ioloop
  File "C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\zmq\eventloop\__init__.py", line 3, in <module>
    from zmq.eventloop.ioloop import IOLoop
  File "C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\zmq\eventloop\ioloop.py", line 56, in <module>
    from zmq.eventloop.platform.auto import set_close_exec, Waker
ImportError: No module named platform.auto
4

2 回答 2

0

知道你sys.path是什么会很有帮助。您可以通过以下方式找到:

$ ipython

In [1]: import sys

In [2]: sys.path

然后在这里分享输出。接下来,您要检查此目录中有哪些文件:

C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages\zmq\eventloop\platform

理想情况下,您会看到auto.py那里,如果C:\Users\btibert\AppData\Roaming\Python\Python27\site-packages在您的 sys.path 中,那么它为什么不起作用是一个谜,但如果该文件不存在,则目录不存在,或者路径不site-packages存在t 在你的sys.path,那么那些需要先解决。

让我们知道,我们可以尝试从那里拿走它!

于 2013-06-25T13:39:23.190 回答
0

我想出了一种方法来攻击它。我真的不认为我必须达到这个级别,但我完全卸载了我能找到的每一个可能的 python 实例。我

  1. 未安装的 Anaconda CE
  2. 删除了对 python 的所有引用PATH
  3. 编辑了我的注册表以清除 python 数据(但确实留下了 Python 文件夹)
  4. 从上述@IanSR 概述的 App/Roaming 路径中​​删除了 python

基本上,我删除了所有我能找到的对 python 的可能引用,然后重新安装了 Anaconda CE。瞧,Anaconda 安装(似乎)已按分销商的预期工作。

于 2013-07-10T00:15:12.050 回答