После установки Django я следовал учебнику Играю с API.Когда я запускаю следующую команду.
python manage.py shell
Я получил это сообщение об ошибке.
File "/Library/Python/2.6/site-packages/django/core/management/commands/shell.py",
line 29, in handle_noargs
shell = IPython.Shell.IPShell(argv=[])
AttributeError: 'module' object has no attribute 'Shell'
Я проверил, что у меня есть модуль Shell.py и класс IPShell внутри него.
/ Библиотека / Python / 2.6 / site-packages / IPython / Shell.py
class IPShell:
"""Create an IPython instance."""
Что с этим не так?Мой IPython / Python / OS выглядит следующим образом.
- Mac OS X 10.6.5
- Python 2.6.1
- Версия IPython 0.10.1
ДОБАВЛЕНО
>>> import IPython
>>> IPython.Shell
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'Shell'
>>> print IPython.__file__
/Library/Python/2.6/site-packages/IPython/__init__.py
РЕШЕНО
С помощью ma3 и Игнасио я мог решить эту проблему.site-package / ipython * .egg
sudo easy_install ipython для новой установки IPython
Примените патч к shell.py в django, как связал Ignacio.
try:
shell = IPython.InteractiveShell()
except AttributeError:
# IPython < 0.11
# Explicitly pass an empty list as arguments, because otherwise IPython
# would use sys.argv from this script.
shell = IPython.Shell.IPShell(argv=[])
shell.mainloop()