Detailed steps for installing Django under Python 3.6 in Ubuntu 16.04 environment

Python is an object-oriented interpreted computer programming language, invented by the Dutchman Guido van Rossum in 1989, and the first public release was issued in 1991.

Python is pure free software. The source code and interpreter CPython follow the GPL (GNU General Public License) agreement. Python syntax is concise and clear, and one of its features is to force white space as a statement indentation.

Python has a rich and powerful library.

It is often nicknamed the glue language,

Able to integrate various modules made in other languages (especially C/C++)

Connected easily.

I just finished learning the basics of Python, and I am already tempted by his power.

Practicing crawlers is undoubtedly a way to strengthen learning python.

I recently saw someone starting with Django, take this opportunity,

Learn and make a record of yourself, hoping to gain something!

The Django project is a Python custom framework, which originated from an online news Web site and was released as an open source in 2005. The core components of the Django framework are:

Django (pronounced: [`dʒæŋɡəʊ]) is an open source web framework written in python. It encourages rapid development and follows the MVC design. Django abides by the BSD copyright. It was first released in July 2005, and the first official version 1.0 was released in September 2008.

First paste a Django study plan mind map:

01

**Now enter the installation process: **

I have installed python2 and python3 under Windows10, and I have installed two corresponding to pip. I want to use python3, so I use pip3 to install below.

Open cmd and enter the command line (take django 1.10.6 as an example, if the version is not specified, the latest version will be installed by default)

pip install django==1.10.6

BUT, there is an unfortunate news that the installation was unsuccessful. Du Niang said for a long time that it was due to a problem with the Windows operating system, so she decided to give up Windows and switch to Linux, even if she found an Ubuntu 16.04 64-bit operating system. , But the system itself comes with python2.7 and python3.5, personally want to use python3.6, so I installed python3.6, detailed steps please move to: https://blog.csdn.net/jiekexu/article/details /80294523

After Python3.6 is installed, continue our Django installation:

1

In this case, there are py2 and py3 in the system, then pip is also the previous pip2, first order to install pip3. But this is also used for python3.5 when using pip3 to install. After the installation is completed, there is no under python3.6. You will find that it appears under python3.5. So, connect the soft link python3 -> python3.5 under /usr/bin Rename it to another name to make it invalid.

2

Then enter /usr/bin/python3.6/bin and you need to upgrade pip3 to use it. Use the following command to upgrade.

sudo /usr/bin/python3.6/bin/pip3 install --upgrade pip

3

Next, install Django, use the following command, if you are a root user, you don't need to add sudo.

sudo /usr/bin/python3.6/bin/pip3 install Django

Collecting pytz (from Django)

Downloading https://files.pythonhosted.org/packages/dc/83/15f7833b70d3e067ca91467ca245bae0f6fe56ddc7451aa0dc5606b120f2/pytz-2018.4-py2.py3-none-any.whl (510kB)

100 % |████████████████████████████████| 512kB 23kB/s

Installing collected packages: pytz, Django

Successfully installed Django-2.0.5 pytz-2018.4

The above shows that the installation is successful.

04

I tested it with python3.6 and found that the installation of Django was also successful. But every time you enter the bin directory to execute the pip command is really annoying, and you have to find the reason.

python@ubuntu:/usr/local/bin$ python

Python 3.6.5 (default, May 12 2018, 19:37:55)

[ GCC 5.4.0 20160609] on linux

Type "help", "copyright", "credits" or "license" for more information.

>>> import django

>>> print(django.get_version())

2.0.5

05

The installation is complete, what is the reason for this pip? Let's take a look!

root@ubuntu:/usr/local# pip3 install jieba

Why keep reporting this error? Go to /usr/local/bin/ to view

root@ubuntu:/usr/local# cat /usr/local/bin/pip3

#! /usr/bin/python3

# - - coding: utf-8 --

The reason was found. I saw that the file call was #!/usr/bin/python3, and because of the existence of python2.7, /usr/bin/python3 was renamed, so it was not found.

If the problem is found, then it is well solved. Edit the /usr/local/bin/pip3 file and change its first line call mode to #!/usr/bin/python

root@ubuntu:/usr/bin# vi /usr/local/bin/pip3

#! /usr/bin/python

06

The verification can be used normally, no error is reported, and you can sleep!

root@ubuntu:/usr/bin# pip3 install jieba

Collecting jieba

Downloading https://files.pythonhosted.org/packages/71/46/c6f9179f73b818d5827202ad1c4a94e371a29473b7f043b736b4dab6b8cd/jieba-0.39.zip (7.3MB)

100 % |████████████████████████████████| 7.3MB 36kB/s

Installing collected packages: jieba

Running setup.py install for jieba ... done

Successfully installed jieba-0.39

root@ubuntu:/usr/bin# python

Python 3.6.5 (default, May 12 2018, 19:37:55)

[ GCC 5.4.0 20160609] on linux

Type "help", "copyright", "credits" or "license" for more information.

>>> import jieba

**>>> **

Recommended Posts

Detailed steps for installing Django under Python 3.6 in Ubuntu 16.04 environment
Detailed tutorial on installing python3.7 for ubuntu18
Method steps for installing and configuring SSH service under Ubuntu 18.04
About installing node environment in Ubuntu server
Method of installing django module in python
Detailed tutorial for installing CUDA9.0 on Ubuntu 16.04
Detailed tutorial for installing phpMyAdmin on Ubuntu 18.04
Build a python development environment under Ubuntu
Graphical tutorial for installing Pycharm 2020.1 in Ubuntu 20.04
Ubuntu20.04 install Python3 virtual environment tutorial detailed explanation
How to install python in ubuntu server environment
Install Python3 environment in a brand new Ubuntu
Steps to add toolkit for Matlab_Linux under ubuntu
Install python3.6 under Ubuntu 16.04
Python MySQLd under Ubuntu
[python] python2 and python3 under ubuntu
Python virtual environment: Ubuntu16.04
Install python in Ubuntu
Installation and use of GDAL in Python under Ubuntu
How to create a Python virtual environment in Ubuntu 14.04
Tutorial for setting up FTP server in Ubuntu 16.04 environment
Resolve the problems encountered in the linux environment under ubuntu
Django&MySQL environment deployment under Ubuntu 14.04
Install python environment under Linux
Detailed steps to automatically set the line number in ubuntu16.04
ubuntu build python development environment
ubuntu offline installation python environment
Detailed steps to install MySQL to change the default password in Ubuntu
Detailed explanation of the installation and use of SSH in the Ubuntu environment
Use QQ under Ubuntu 13.10, suitable for 14.10
Python embeds C/C++ for detailed development
Detailed sorting algorithm (implemented in Python)
Detailed usage of dictionary in Python
Installation instructions for gitlab in Ubuntu
Python Chinese encoding setting under ubuntu
Install Python virtual environment on Ubuntu 18.04
Steps to upgrade Laravel 5.4 to 5.6 in Ubuntu 16.04
Tutorial diagram for installing zabbix2.4 under centos6.5
Error when installing Python module on Ubuntu
Solution for Postgresql uninstall error under Ubuntu
Deploy django application in ubuntu through nginx+uwsgi
Set UTF-8 encoding for MySQL5.7 in Ubuntu 16.04
JDK environment variable configuration method under ubuntu
Build the C++ compilation environment under ubuntu
Configure Java development environment in Ubuntu20.04 LTS
Steps to build LNMP environment on ubuntu 20.04
Download OpenJDK11 source code in Ubuntu environment
Graphical tutorial for installing JDK1.8 under CentOS7.4
Install PyTesser under ubuntu 14.04 for OCR recognition
Python and scrapy deployment in centos environment
Detailed usage of Python virtual environment venv
GPU programming (1): CUDA8.0 environment construction under Ubuntu
Detailed tutorial on installing MySQL 8 in CentOS 7
Configure Nginx + PHP 7.0 + MySQL environment under Ubuntu 16.04
Docker those things in the Ubuntu environment
Edit OpenJDK11 source code in Ubuntu environment