Linux loaded Python3

Source: Internet
Author: User
Tags sqlite install django

Remember to download the software is best installed under the/opt the default people do this

Linux Install python3.7 We do the testing with the latest installation.

Download the associated package first to prevent errors

It is important to install the library environment before Python, yum install gcc patch
Libffi-devel python-devel  zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel Gdbm-devel Db4-devel Libpcap-devel xz-devel-y

Then compile and install Python

Download the corresponding Python version

https://www.python.org/ftp/python/

Extract:

TAR-XF python-3.7. 0. tgz   # This is the corresponding version

And then the CD switches in.

CD python-3.7. 0

Then execute:

./configure--prefix=/opt/python37

And then I'm done. This is a call to C for some interface instructions

Make

Then make install

Make  Install

The above two steps can be changed to:

Make  && make install

And then:

Then switch to the file directory where you just compiled the installation

CD  /opt/python37

and see what files: ls

Then the test executes the bin directory under the

Bin/python3. 7

To create a soft connection is to add python3.7 to the Global environment

Ln-s/opt/python37/bin/python3. 7 /usr/local/bin/python3

Then mount the Python installation package command PIP3

Ln-s/OPT/PYTHON37/BIN/PIP3/USR/LOCAL/BIN/PIP3

To install Django:

You must first install the PIP3 with the above command.

Same as PIP installation under Widows

PIP3 Install django==2.0

Unloading:

PIP3 Uninstall Django

Upgrade your PIP

PIP3 Install--upgrade pip
 Installing python3.5

Also to execute all dependent packages;

Yum install gcc patch libffi-devel python-devel  zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel Readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel-y

It was python3.7 's bad, we loaded 3.5.

Download python3.5.6 Source code

wget https://www.python.org/ftp/python/3.5.6/Python-3.5.6.tgz

Python source. (It's all here.)

https://www.python.org/ftp/python/

Then unzip:

TAR-XF python-3.5. 6. tgz

Generate a compilation script (specify the installation directory) to install the Python35 directory under/opt under the root directory

./configure--prefix=/opt/python35

Then perform a compilation installation:

Make  && make install

Then switch to the PYTHON35 directory

Then add a soft connection

We built the python3.7 PIP3, we're going to use python3.7 's activities.

Build 3.5 of PIP3

Delete the previous PIP3

Rm-rf/usr/local/bin/pip3

Ln-s/OPT/PYTHON35/BIN/PIP3/USR/LOCAL/BIN/PIP3

Installing django1.1

python3-m pip install-i https://pypi.tuna.tsinghua.edu.cn/simple django==1.11

Django is installed by default in the Bin directory under the Python directory

Create a Django Soft connection

Ln-s/opt/python35/bin/django-admin      /usr/local/bin/django-admin

Then create a data directory under the/root directory

mkdir  Data

Switch to the Data directory

Create a Django Program

Django-admin Startproject MySite

And then you're going to go in your MySite program in the settings to modify the configuration so that everyone can link to your program, or it can only be native access

Enter the settings configuration

allowed_hosts = ['*']

Then switch to your data directory or other directory to migrate your database (this step is the same as Windows)

Python3 manage.py makemigrations Python3 manage.py Migrate

And then start your Django at this time.

Python3 manage.py runserver  0.0.  0.0:8000   # This is setting up your boot port

And it's done with your Django project launch.

Then you can use your widows to enter your IP and link to this port.

install Python3 on Linux.5. 6 Detailed document!!! 1. Install dependent Libraries (toolkit) Yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel D B4-devel Libpcap-devel Xz-devel-y2Download Python3 Source code (enter command under Linux terminal) toggle/opt Catalog CD/opt #下载python3.5. 6 Source code wget https://www.python.org/ftp/python/3.5.6/Python-3.5.6.tgz#python源码的. (It's all here) https://www.python.org/ftp/python/        3. Extracting source code tar-XF python-3.5.6. tgz (Appears Python-3.5.6)4. Toggle the python3.5 source Directory CD Python-3.5.6        5. Generate a compilation script (specify the installation directory)./configure--prefix=/opt/python356. Compile make7after the compilation is successful, compile and install make installation.8. Switch the python3.5 directory CD that is already installed/opt/python35/9. View python3.5 executable script file [[email protected] python35]# ls bin/Ten. Executing the python3.5 interpreter1. Absolute path Execution mode one/opt/python35/bin/python3.5            2. Relative path execution mode two [[email protected] python35]# bin/python3.5            3. Add Environment Variables1Add a soft connection (usage) ln-s original file path destination file path2Add a soft connection (absolute path) ln-s/opt/python35/bin/python3.5/usr/local/bin/Python34. Add PIP3 soft Connect ln-s/opt/python35/bin/pip3/usr/local/bin/PIP35. View PIP3 version PIP3-V Pip10.0.1  from/opt/python35/lib/python3.5/site-packages/pip (python3.5) tip:python3.5 Soft connection: ln-s/opt/python35/bin/python3.5/usr/local/bin/python3.5to delete a python3.5 soft connection: RM-rf/usr/local/bin/Python3 Installing Django1. Install Django Mode 1 PIP3 install Django==1.11Way 2:python3-M pip install-i https://pypi.tuna.tsinghua.edu.cn/simple django==1.11uninstalling the Django pip3 Uninstall Django Update Pip tool PIP3 install--upgrade Pip2after installing the django1.11, configure the soft connect ln-s/opt/python35/bin/django-admin/usr/local/bin/django-Admin3. Start Django vi settings.py write Allowed_hosts= ['*'] To start the Django Python3.5manage.py Runserver0.0.0.0:8000    4. Windows access to Linux IP address +Port x.x.x.x:8000code upload and run1. Windows write-down code modifies the appropriate configuration file2. Test bug!!!! 3. Transferring to the server via Xftp4. Start the project
Installation Steps

Linux loaded Python3

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.