我只是通過將所有文件複製到/var/www/some/dir/djangoApp
,將一個工作的django應用程序從Windows系統移植到ubuntu。但現在,執行manage.py - ImportError:沒有名爲django的模塊
python manage.py runserver 8080
當我得到的錯誤:
ImportError: no module named django
我已經安裝的Django的新版本python setup.py install
到/usr/local/lib/python2.7/dist-packages/django/
並添加路徑PYTHONPATH。
linux系統在我沒有維護,並有許多python版本安裝。在外殼中調用>>> import django
不會引發ImportError。
我很困惑。請幫幫我!
下面是從控制檯回溯:
Traceback (most recent call last):
File "manage.py", line 13, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 280, in execute
translation.activate('en-us')
File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py", line 130, in activate
return _trans.activate(language)
File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 188, in activate
_active.value = translation(language)
File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
ImportError: No module named django
您需要安裝所有的軟件包,安裝一個虛擬ENV,然後在原機: 'PIP凍結> requirements.txt' 從原始機器requirements.txt到您的沙箱然後: 在你的virtualenv: 'pip install -r requirements.txt' – petkostas