Python3 installing Django under Mac OS

Source: Internet
Author: User
Tags install django

1. View PIP version No, it's not. When you install Python successfully, the PIP is usually installed automatically.

 -V//correspondsto python2.7 9.0.1 From/library/python/2.7/site-packages/pip-9.0.1-py2.7.egg (Python 2.7  -V//correspondsto python3.6 9.0.1 from/library/frameworks/python.framework/versions/3.6/lib/python3.6/ Site-packages (Python 3.6)

2. Install django,1.11.7 with Pip3/python3 is the latest stable version (official website download page has https://www.djangoproject.com/download)
Here, use sudo or you'll get an error.
sudo pip3 install django==1.11.7

Tips:

2.1.dev20171130142844//Before using GitHub to download the latest version of the installation, 2. x version too high uninstalling Django-2.1. dev20171130142844: Successfully uninstalled Django-2.1.dev20171130142844// automatically uninstall the previous version successfully installed Django- 1.11.7//Installation Successful

3. Test whether the installation is successful
Cd/users/z/pyp/django

4. Create a new service
sudo django-admin.py startproject testlocalhostcd testlocalhost

5. Run the service, because Django is installed with Pip3/python3, so it should be run with Python3.
Python3 manage.py Runserver

Let the command line fly for a while ~

... xxx.....xxxdjango.db.utils.operationalerror:unable to open database file

An error has been made.

6. Then run with administrator privileges:
sudo python3 manage.py runserver


Print:

Performing system checks ... System Check identified no issues (0 silenced). You have unapplied migration (s). Your project properly until you apply the Migrations for app (s): admin, Auth, contenttypes, sessions. Run ' python manage.py migrate ' to apply them. December, 2017-08:33:50django version 1.11.7, using Settings ' testlocalhost.settings ' starting development Server at H Ttp://127.0.0.1:8000/quit the server with Control-c.

Successful, the browser input http://127.0.0.1:8000/can be seen


View the Django version

Import Django Print (Django.) VERSION)

Print: (1, one, 7, ' final ', 0) description is 1.11.7 version.

View Python3 installation directory

Import SYS Print (Sys.path)

Print xxxxxx /library/frameworks/python.framework/versions/3.6/lib/python3.6 xxxx is the Python3 installation directory

PIP3 installation directory:/LIBRARY/FRAMEWORKS/PYTHON.FRAMEWORK/VERSIONS/3.6/LIB/PYTHON3.6/SITE-PACKAGES/PIP

PIP installation directory in the default Python directory

Django installation directory (installed with PIP3):/library/frameworks/python.framework/versions/3.6/lib/python3.6/site-packages/ Django

Python3 installing Django under Mac OS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.