Django:'ValueError:_type_'v'不支持'尝试运行Shell时

时间:2016-01-21 20:23:23

标签: python django

我试图通过Django manage.py文件运行python shell,如下所示:$ python manage.py shell --plain

我一直遇到这个ValueError:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/donnyknight/Desktop/djangoproj/djangoenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/Users/donnyknight/Desktop/djangoproj/djangoenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/donnyknight/Desktop/djangoproj/djangoenv/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/donnyknight/Desktop/djangoproj/djangoenv/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/Users/donnyknight/Desktop/djangoproj/djangoenv/lib/python2.7/site-packages/django/core/management/commands/shell.py", line 77, in handle
    import readline
  File "/usr/local/lib/python2.7/site-packages/readline.py", line 6, in <module>
    from pyreadline.rlmain import Readline
  File "/usr/local/lib/python2.7/site-packages/pyreadline/__init__.py", line 12, in <module>
    from . import logger, clipboard, lineeditor, modes, console
  File "/usr/local/lib/python2.7/site-packages/pyreadline/clipboard/__init__.py", line 13, in <module>
    from .win32_clipboard import GetClipboardText, SetClipboardText
  File "/usr/local/lib/python2.7/site-packages/pyreadline/clipboard/win32_clipboard.py", line 37, in <module>
    import ctypes.wintypes as wintypes
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/wintypes.py", line 23, in <module>
    class VARIANT_BOOL(_SimpleCData):
ValueError: _type_ 'v' not supported

我在Mac上看到它正在尝试调用Windows软件包,但我不知道如何配置Django来解决这个问题。

非常感谢任何帮助。

修改 问题可能源于readlines.py文件。当我试图自己导入它时,我得到:

Traceback (most recent call last):
  File "/Users/donnyknight/Desktop/Django/djangotest/mysite/test.py", line 1, in <module>
    import readline
ImportError: dlopen(/Users/donnyknight/Desktop/Django/djangoenv/lib/python2.7/readline.so, 2): no suitable image found.  Did find:
/Users/donnyknight/Desktop/Django/djangoenv/lib/python2.7/readline.so: file too short

编辑#2 - 这似乎是virtualenv的一个问题。在virtualenv之外运行此命令可以正常工作。

0 个答案:

没有答案