本文介绍了“ValueError:_type_'v'不受支持”安装PyReadline后出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装PyReadline后,IPython无法正常工作。当我卸载它时,它再次开始工作。

After I installed PyReadline, IPython won't work. When I uninstalled it, it starts working again.

ipython的堆栈跟踪:

The stack trace for ipython:

(py2.7_monitor)[root@vm10-136-8-98 monitor]# ipython
WARNING: IPython History requires SQLite, your history will not be saved
Traceback (most recent call last):
  File "/home/py2.7_monitor/bin/ipython", line 11, in <module>
    sys.exit(start_ipython())
  File "/home/py2.7_monitor/lib/python2.7/site-packages/IPython/__init__.py", line 118, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/home/py2.7_monitor/lib/python2.7/site-packages/traitlets/config/application.py", line 591, in launch_instance
    app.initialize(argv)
  File "<string>", line 2, in initialize
  File "/home/py2.7_monitor/lib/python2.7/site-packages/traitlets/config/application.py", line 75, in catch_config_error
    return method(app, *args, **kwargs)
  File "/home/py2.7_monitor/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 314, in initialize
    self.init_shell()
  File "/home/py2.7_monitor/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 330, in init_shell
    ipython_dir=self.ipython_dir, user_ns=self.user_ns)
  File "/home/py2.7_monitor/lib/python2.7/site-packages/traitlets/config/configurable.py", line 380, in instance
    inst = cls(*args, **kwargs)
  File "/home/py2.7_monitor/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 531, in __init__
    self.init_readline()
  File "/home/py2.7_monitor/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 1941, in init_readline
    import IPython.utils.rlineimpl as readline
  File "/home/py2.7_monitor/lib/python2.7/site-packages/IPython/utils/rlineimpl.py", line 21, in <module>
    _rl = __import__(_rlmod_name)
  File "/home/py2.7_monitor/lib/python2.7/site-packages/readline.py", line 6, in <module>
    from pyreadline.rlmain import Readline
  File "/home/py2.7_monitor/lib/python2.7/site-packages/pyreadline/__init__.py", line 12, in <module>
    from . import logger, clipboard, lineeditor, modes, console
  File "/home/py2.7_monitor/lib/python2.7/site-packages/pyreadline/clipboard/__init__.py", line 13, in <module>
    from .win32_clipboard import GetClipboardText, SetClipboardText
  File "/home/py2.7_monitor/lib/python2.7/site-packages/pyreadline/clipboard/win32_clipboard.py", line 37, in <module>
    import ctypes.wintypes as wintypes
  File "/usr/local/lib/python2.7/ctypes/wintypes.py", line 23, in <module>
    class VARIANT_BOOL(_SimpleCData):
ValueError: _type_ 'v' not supported


推荐答案

在他们的网站上, PyReadline 库用于 Windows

As stated on their site, the PyReadline library is Used for Windows.

查看堆栈跟踪的最后几行:

Looking at the last lines of your stack trace:

import ctypes.wintypes as wintypes
File "/usr/local/lib/python2.7/ctypes/wintypes.py", line 23, in <module>
class VARIANT_BOOL(_SimpleCData):
ValueError: _type_ 'v' not supported

它试图从 ctypes 导入特定于Windows的数据类型,这显然是不可能的,因为你没有运行Windows。

It is trying to import windows specific data types from ctypes which is obviously not possible since you are not running Windows.

这篇关于“ValueError:_type_'v'不受支持”安装PyReadline后出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 11:03