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 --
import re*
import sys*
from pip._internal import main*
if name == 'main':*
sys.argv[0] = re.sub(r'(-script.pyw|.exe)?$', '', sys.argv[0])*
sys.exit(main())*
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