【发布时间】:2014-04-17 10:52:23
【问题描述】:
我已经在虚拟环境中的机器上安装了 ipython,如下所示
pip install ipython
Downloading/unpacking ipython
Downloading ipython-2.0.0.tar.gz (11.9MB): 11.9MB downloaded
Running setup.py egg_info for package ipython
Installing collected packages: ipython
Running setup.py install for ipython
checking package data
Installing ipengine2 script to /home/user/.virtualenvs/project/bin
Installing iptest script to /home/user/.virtualenvs/project/bin
Installing ipython2 script to /home/user/.virtualenvs/project/bin
Installing ipcluster2 script to /home/user/.virtualenvs/project/bin
Installing ipcluster script to /home/user/.virtualenvs/project/bin
Installing ipython script to /home/user/.virtualenvs/project/bin
Installing ipcontroller2 script to /home/user/.virtualenvs/project/bin
Installing ipcontroller script to /home/user/.virtualenvs/project/bin
Installing iptest2 script to /home/user/.virtualenvs/project/bin
Installing ipengine script to /home/user/.virtualenvs/project/bin
Successfully installed ipython
Cleaning up...
所以当我从 virtualenv 内部以 python manage.py shell 启动我的 shell 时,我看到以下错误
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/home/user/.virtualenvs/project/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/home/user/.virtualenvs/project/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/user/.virtualenvs/project/local/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/user/.virtualenvs/project/local/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/home/user/.virtualenvs/project/local/lib/python2.7/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/home/user/.virtualenvs/project/local/lib/python2.7/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'
Django 版本 - 1.2.3 venv 内的 ipython 版本 - 2.0.0
那么为什么会出现以及如何避免,我以前没有经历过这种情况
【问题讨论】:
标签: python django shell virtualenv