//pip版本 pip -V //對應python2.7 pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7) pip3 -V //對應python3.6 pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (python 3.6)
sudo pip3 install Django==1.11.7
提示 :python
Installing collected packages: Django Found existing installation: Django 2.1.dev20171130142844 //以前用github下載安裝的最新版,2.x 版本過高 Uninstalling Django-2.1.dev20171130142844: Successfully uninstalled Django-2.1.dev20171130142844 //自動卸載掉以前的版本 Successfully installed Django-1.11.7 //安裝成功
cd /Users/z/PyP/Django
sudo django-admin.py startproject testLocalHost
cd testLocalHost
python3 manage.py runserver
...xxx
.....xxx
django.db.utils.OperationalError: unable to open database file
報錯了。git
sudo python3 manage.py runserver
打印:github
Performing system checks...
System check identified no issues (0 silenced).
You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
December 01, 2017 - 08:33:50
Django version 1.11.7, using settings 'testLocalHost.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
成功,瀏覽器輸入http://127.0.0.1:8000/能夠看到django
查看Django版本瀏覽器
import django print(django.VERSION)
打印:(1, 11, 7, 'final', 0) 說明是1.11.7版本。session
查看python3安裝目錄app
import sys print(sys.path)
打印xxxxxx /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6 xxxx 便是python3安裝目錄python2.7
pip3 安裝目錄:/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipide
pip 安裝目錄在默認python目錄下測試
Django安裝目錄(用pip3安裝) :/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django