2017-08-02 29 views
0

我想這樣導入Django不上的virtualenv工作(Ubuntu的)

source my_env/bin/activate 

然後東西我檢查是否安裝

python -c "import django; print(django.get_version())" 
1.9.13 

但導入失敗

import django 

的Django只出現十字。如何解決Django導入?

+0

交叉出現在哪裏?在你的IDE中?你確定你在你的IDE中設置解釋器來引用安裝在VirtualEnv中的python bin嗎? –

+0

@MatthijsBrouns那麼我運行從終端的一切。我可以創建django-admin startproject mysite後者,但我confisd爲什麼導入失敗。 – MishaVacic

+0

我仍然不明白你的意思是「只有交叉出現」。你能否澄清這個十字架在哪裏出現? –

回答

1

這聽起來像你在你的bash shell中運行import django。這是從Imagemagick運行import

$ import django 

相反,你應該開始Python的殼,然後在Python shell中運行import django

$ python # or python manage.py shell 
>>> import django