Python--Installation

Source: Internet
Author: User

Small Q easily change but the hearts of the people are easy to change. ---Nalinjon if

--------------------------------------------------------------------------------------------------

Python official website http://www.python.org/
Python document www.python.org/doc/

Installation Platform windows Linux/unix Mac OS X

Window

Open a Web browser to access http://www.python.org/download/

In the download, select the Window platform installation package format PYTHON-XYZ. MSI XYZ is the version number of the installation;

To use Setup Python-xyz.msi, Windows system must support Microsoft Installer 2.0 with the use of just save the installation files to local and then run to see your machine support MSI. XP and later versions already have MSI many older machines can also install MSI.

After downloading, double-click into the Python Installation Wizard to install

Set Environment variables:

In the command prompt (cmd) input: path=%path%;D: \python installation directory in D:\Python

or add a path in the advanced system settings of the computer's properties, such as

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/80/2E/wKiom1c6f7_zqymOAAGiCM09ZH0170.png "title=" Qq20160517101040.png "alt=" Wkiom1c6f7_zqymoaagicm09zh0170.png "/>

Test: entering the cmd command line executes python into the Python environment interface.

M A C

The most recent Macs system comes with a python environment you can also link http://www.python.org/download/

Download the latest version of the installation.

L i n u x

Python (the python that comes with is not too friendly to perform the TAB key)

Ipython (Python's advanced interface is relatively easy to use the following are all for Ipython)

Two ways of installing

Run the Ipython command test on GitHub or some websites after unpacking the package using setup.py install installation

or Use the PIP command to install PIP installation like Yum installation but first install the PIP command Yum install-y python-pip If you can't find a PIP package you can first install an extension source after you enter the installation command pip install Ipyth On

See if PIP list is installed | grep Ipython

Note: The PIP default installation is downloaded Https://pypi.python.org/pypi under the highest version of Ipython there may be a low installation because Python version is not successful as shown below when Python is below version 2 Ipython will not work

At this point we can make the specified version install pip install ipython=1.2.1

650) this.width=650; "style=" width:600px;height:226px; "src=" http://s3.51cto.com/wyfs02/M00/80/2C/ Wkiol1c6haqy3lsmaabq7bg__ma310.png "title=" Qq20160517104027.png "alt=" Wkiol1c6haqy3lsmaabq7bg__ma310.png "border= "0" height= "226" hspace= "0" vspace= "0" width= "/>"

Set Environment variables : Normal PIP is installed by default in/usr/bin do not need to set variable

In csh shell:setenv PATH "$PATH:/usr/local/bin/python"
In bash Shell:export path= "$PATH:/usr/local/bin/python"
In sh or ksh:path= "$PATH:/usr/local/bin/python"
View : Pip list |grep Ipython ipython-v python-v

Test : Enter Ipython into Ipython environment interface


========================= file Type ===========================

Python has three types of file type source files, byte code files, optimized code files

Source files:

Vim 1.py

#/usr/bin/python Python Execution Command path

# Coding=utf-8 or-*-coding:utf-8-*-(default ASCII format so you need to specify encoding)

print "Hello World!"

print "Hello World!"

byte code :

Vim 2.py

#/usr/bin/python

Import Py_compile

Py_compile.compile (' 1.py ') #1. py Writable Absolute path

Execute 2.pypython 2.py--you will find that 1.PYC is generated when it is opened as a binary file but can be executed.

Optimized code :

Python-o-M Py_compile 1.py

You will find that a 1.pyo file is also generated and binary files are also working correctly.

Type view:

File File name

Python--Installation

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.