简体   繁体   English

Python IDLE总是在Mac上崩溃,我该如何解决?

[英]Python IDLE always crashes on my Mac, how can I fix it?

I'm using Mac OS 10.9, and when I open Terminal, enter Python IDLE, and input some code like: 我使用的是Mac OS 10.9,打开终端后,输入Python IDLE,然后输入一些代码,例如:

$ django-admin.py startproject mysite
$ python manage.py runserver
$ python manage.py syncdb
$ from django.db import models

Especially input from django.db import models , then the Python IDLE will crash. 特别是from django.db import models输入,那么Python IDLE将崩溃。 It happens every time. 每次都会发生。 Why is this happening? 为什么会这样呢? How can I fix it? 我该如何解决?

If you'd like to play with your models from the command line, you'll first need to start a Python shell. 如果您想从命令行使用模型,则首先需要启动Python Shell。 As @evert mentioned in his comment, your fourth line cannot simply be typed into a Mac/Linux shell. 正如@evert在他的评论中提到的那样,您的第四行不能简单地输入到Mac / Linux shell中。

You could work with models in a Python shell if you wanted using the manage.py shell: 如果要使用manage.py shell,可以在Python shell中使用模型:

$ python manage.py shell
Python 2.7.3 (default, Aug  1 2012, 05:16:07) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.db import models

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM