ImportError: No module named termios with django_m

2019-08-13 09:55发布

I'm on a 64bit Windows machine working on a Django project using PyCharm. Django 1.8.7, Python 2.7.9, MySQL 5.6. I'd like to try out django_mysql, but I get:

Unhandled exception in thread started by <_pydev_bundle.pydev_monkey._NewThreadStartupWithTrace instance at 0x03F8AE90>
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 2016.1\helpers\pydev\_pydev_bundle\", line 551, in __call__
    return self.original_func(*self.args, **self.kwargs)
  File "C:\Users\Admin\test\lib\site-packages\django\utils\", line 229, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\Admin\test\lib\site-packages\django\core\management\commands\", line 107, in inner_run
  File "C:\Users\Admin\test\lib\site-packages\django\utils\", line 252, in raise_last_exception
  File "C:\Users\Admin\test\lib\site-packages\django\utils\", line 229, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\Admin\test\lib\site-packages\django\", line 18, in setup
  File "C:\Users\Admin\test\lib\site-packages\django\apps\", line 85, in populate
    app_config = AppConfig.create(entry)
  File "C:\Users\Admin\test\lib\site-packages\django\apps\", line 112, in create
    mod = import_module(mod_path)
  File "c:\python27\Lib\importlib\", line 37, in import_module
  File "C:\Users\Admin\test\lib\site-packages\django_mysql\", line 5, in <module>
    from .checks import register_checks
  File "C:\Users\Admin\test\lib\site-packages\django_mysql\", line 8, in <module>
    from django_mysql.utils import collapse_spaces
  File "C:\Users\Admin\test\lib\site-packages\django_mysql\", line 5, in <module>
    import pty
  File "c:\python27\Lib\", line 11, in <module>
    import tty
  File "c:\python27\Lib\", line 5, in <module>
    from termios import *
ImportError: No module named termios

I installed Cygwin, which seemed to help people with similar issues, but I still get this error. I restarted PyCharm. Should I restart the machine? Am I missing some application form the INSTALLED_APPS?

My purpose with django_mysql is to use JSONField, maybe I should try another package?

2楼-- · 2019-08-13 10:29

library author here. Turns out pty doesn't exist on Windows Python distributions. I've deployed a new Django-MySQL version, 1.0.8, to deal with this. See

登录 后发表回答