我刚按照本教程首次安装了Python和Django 在Django网站上,到此为止的所有工作都很好,没有产生任何错误。
I just installed Python and Django for the first time while following this tutorial on the Django site, and everything up to this part worked just fine and produced no errors.
现在我在开发服务器部分,运行命令 python manage.py runserver 而在我的项目目录中 manage.py 所在的位置时,出现此错误:
Now I'm at the "The development server" section, and ran the command python manage.py runserver while in my project directory where the manage.py is located and I get this error:
分段错误
Segmentation fault
任何人都知道这里发生了什么以及如何解决这个问题?
Anyone know what's going on here and how I can solve this?
如果有关系,这就是我的manage.py文件(django.core.management ... 中中的 django 我的IDE(PyCharm)中的错误,错误提示未解决的引用'django'):
If it matters, this is my manage.py file (the django in the from django.core.management ... line is marked as an error in my IDE (PyCharm) and the error says Unresolved reference 'django'):
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "davilex.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)推荐答案
这发生在我的Django项目中,我有很多带有C扩展名的软件包。运行Ubuntu系统软件包更新后,突然发现 manage.py 命令段出错。事实证明,某些C扩展会将自身链接到系统库,如果软件包更新更改了这些库,则可能导致C扩展崩溃。
This happened to me in a Django project where I had a lot of packages that had C-extensions. After I ran an Ubuntu system package update, I suddenly found that the manage.py command seg faulted. Turns out, some C-extensions link themselves to system libraries, and if a package update changes those libraries, it could cause the C-extensions to crash.
将所有内容安装在Python virtualenv内,然后删除并重新生成它,即可解决该错误。
Since I had installed everything inside a Python virtualenv, I just deleted and regenerated it, and that fixed the error.
更多推荐
Django:“ python manage.py runserver”给出“ Segmentation fault”错误
发布评论