问题
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\pydev_monkey.py", line 551, in __call__
return self.original_func(*self.args, **self.kwargs)
File "C:\Users\Admin\test\lib\site-packages\django\utils\autoreload.py", line 229, in wrapper
fn(*args, **kwargs)
File "C:\Users\Admin\test\lib\site-packages\django\core\management\commands\runserver.py", line 107, in inner_run
autoreload.raise_last_exception()
File "C:\Users\Admin\test\lib\site-packages\django\utils\autoreload.py", line 252, in raise_last_exception
six.reraise(*_exception)
File "C:\Users\Admin\test\lib\site-packages\django\utils\autoreload.py", line 229, in wrapper
fn(*args, **kwargs)
File "C:\Users\Admin\test\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Admin\test\lib\site-packages\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Admin\test\lib\site-packages\django\apps\config.py", line 112, in create
mod = import_module(mod_path)
File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Users\Admin\test\lib\site-packages\django_mysql\apps.py", line 5, in <module>
from .checks import register_checks
File "C:\Users\Admin\test\lib\site-packages\django_mysql\checks.py", line 8, in <module>
from django_mysql.utils import collapse_spaces
File "C:\Users\Admin\test\lib\site-packages\django_mysql\utils.py", line 5, in <module>
import pty
File "c:\python27\Lib\pty.py", line 11, in <module>
import tty
File "c:\python27\Lib\tty.py", 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?
回答1:
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 https://github.com/adamchainz/django-mysql/issues/272
来源:https://stackoverflow.com/questions/36508126/importerror-no-module-named-termios-with-django-mysql-on-windows