2015-08-15 62 views
1

我有一個Django項目,已經部署。我爲項目使用了virtualenv,並在其中安裝了django。我已經激活了virtualenv。錯誤在virtualenv中運行createsuperuser

當我鍵入pip freeze我得到:

Django==1.7.1 
django-jalali==1.1 
django-multiselectfield==0.1.3 
jdatetime==1.3 

但當我嘗試這個命令:python3 manage.py createsuperuser我得到以下錯誤:

(.env)[email protected]:/srv/bmn-reg$ python3 manage.py createsuperuser 
Traceback (most recent call last): 
    File "manage.py", line 8, in <module> 
    from django.core.management import execute_from_command_line 
ImportError: No module named 'django' 
(.env)[email protected]:/srv/bmn-reg$ 

我怎樣才能解決這個問題?

+0

你的默認python是什麼?是2.X嗎?如果是這樣,你想使用'python3',你需要用pip3來安裝你的需求。 – Kasramvd

回答

4

檢查whethere pip通過發出以下命令,使用python3

pip -V 

您可能需要使用pip3pip3.x將包安裝到Python的3.x的環境中,如果pip是使用Python 2.x版本

UPDATE

您使用virtualenv,你應該使用python(引用正確的蟒蛇可執行文件),而不是python3(可能引用蟒蛇3.X的系統版本)。