在Windows下使用iPython

安装

  1. 安装python。官网下载去:http://www.python.org/getit/
  2. 安装distribute。下载这个py,然后运行:http://python-distribute.org/distribute_setup.py
  3. 安装pip。下载这个py,然后运行:https://raw.github.com/pypa/pip/master/contrib/get-pip.py
  4. 启动命令行(注意,如果是win7/vista及以上,用管理员权限:不会?右键cmd,然后选择“以管理员身份运行”)
  5. 安装pyreadline。运行命令pip install pyreadline。一定要先安装这个,然后再安装ipython,否则ipython无法执行。
  6. 安装ipython。运行pip install ipython
  7. 安装完毕,输入ipython启动

可能遇到的问题

1. 无法启动ipython,报如下错

Traceback (most recent call last):
  File "C:\Python27\Scripts\ipython-script.py", line 5, in <module>
    from pkg_resources import load_entry_point
  File "C:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\pkg_resources.
py", line 2809, in <module>
    parse_requirements(__requires__), Environment()
  File "C:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\pkg_resources.
py", line 594, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pyreadline>=1.7.1

这是安装第四步,没有使用管理员权限执行;以及没有先安装pyreadline的缘故。

2. 执行ipython qtconsole时候报错

Error in sys.excepthook:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\IPython\frontend\qt\console\qtconsoleapp.p
y", line 51, in gui_excepthook
    old_excepthook(exctype, value, tb)
TypeError: 'NoneType' object is not callable

Original exception was:
Traceback (most recent call last):
  File "C:\Python27\Scripts\ipython-script.py", line 9, in <module>
    load_entry_point('ipython==0.13.1', 'console_scripts', 'ipython')()
  File "C:\Python27\lib\site-packages\IPython\frontend\terminal\ipapp.py", line
388, in launch_new_instance
    app.initialize()
  File "<string>", line 2, in initialize
  File "C:\Python27\lib\site-packages\IPython\config\application.py", line 84, i
n catch_config_error
    return method(app, *args, **kwargs)
  File "C:\Python27\lib\site-packages\IPython\frontend\terminal\ipapp.py", line
313, in initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<string>", line 2, in initialize
  File "C:\Python27\lib\site-packages\IPython\config\application.py", line 84, i
n catch_config_error
    return method(app, *args, **kwargs)
  File "C:\Python27\lib\site-packages\IPython\core\application.py", line 325, in
 initialize
    self.parse_command_line(argv)
  File "C:\Python27\lib\site-packages\IPython\frontend\terminal\ipapp.py", line
308, in parse_command_line
    return super(TerminalIPythonApp, self).parse_command_line(argv)
  File "<string>", line 2, in parse_command_line
  File "C:\Python27\lib\site-packages\IPython\config\application.py", line 84, i
n catch_config_error
    return method(app, *args, **kwargs)
  File "C:\Python27\lib\site-packages\IPython\config\application.py", line 420,
in parse_command_line
    return self.initialize_subcommand(subc, subargv)
  File "<string>", line 2, in initialize_subcommand
  File "C:\Python27\lib\site-packages\IPython\config\application.py", line 84, i
n catch_config_error
    return method(app, *args, **kwargs)
  File "C:\Python27\lib\site-packages\IPython\config\application.py", line 352,
in initialize_subcommand
    subapp = import_item(subapp)
  File "C:\Python27\lib\site-packages\IPython\utils\importstring.py", line 40, i
n import_item
    module = __import__(package,fromlist=[obj])
  File "C:\Python27\lib\site-packages\IPython\frontend\qt\console\qtconsoleapp.p
y", line 56, in <module>
    from IPython.external.qt import QtCore, QtGui
  File "C:\Python27\lib\site-packages\IPython\external\qt.py", line 43, in <modu
le>
    raise ImportError('Cannot import PySide >= 1.0.3 or PyQt4 >= 4.7')
ImportError: Cannot import PySide >= 1.0.3 or PyQt4 >= 4.7

安装PyQt即可:pip install pyqt

 

你可能感兴趣的:(windows)