[Learn python with me] Python installation and configuration details,

Source: Internet
Author: User

[Learn python with me] Python installation and configuration details,

Python installation and configuration



1. Introduction to Python

Ii. Install python

1. install it in windows

2. Install

3. Configure the python integrated development environment (IDE) in windows)

1. Install the PyDev plug-in Eclipse

2. Configure Python Interpreters

4. Create a Python Project

5. Compile HelloWorld

Vi. Summary


1. Introduction to Python: 

Python is available in Linux, windows, Mac OS, and other operating systems. It can be used across platforms unless platform-related functions or libraries of specific platforms are used.
1. There are many python implementation versions, including the following: 
CPython: written in C language.
Jython: java implementation version of Python, which compiles the code into a java bytecode.
IronPython: introduces Python to the. NET environment.
PyPy: the Python interpreter is written in Python.

2. Python features: 
Easy to learn
Free Open Source
High-level Language
Rich Libraries
Ii. Install python 

1. install it in windows 
Windows is widely used because all the operations in windows have become very simple. You only need to click "Next" to install the software. Python is no exception. You can go to the next Windows version of python on the Internet (everywhere on the internet). I am using python-2.7.2. After the installation, it will be OK. Finally, configure the environment variables as follows:

1) Find the path in the system variable, as shown in figure 1)


2) edit the path value and add the python path you have installed. See figure 2)


3) Check whether python is successfully installed and configured. Open cmd and enter python. If the following interface is displayed, it indicates that your python installation is successful. See figure 3)


2. Install

1) download Source: http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2

2) installation. Generally, there won't be too many problems. You may have permissions. You only need to add sudo before the command to solve the problem.

Python code
  1. $ Tar-jxvf Python-2.7.3.tar.bz2
  2. $ Cd Python-2.7.3
  3. $./Configure
  4. $ Make
  5. $ Make install


3) test. Input python on the terminal. If the result (Figure 3) is displayed, the installation is successful. However, in some versions of Linux, python is installed by default. The python version installed by default is generally relatively low. The above operations do not allow the current python version to be updated to python-2.7.3, you also need to do the following:


Python code
  1. # Cd/usr/bin
  2. # Ll | grep python // view python related files in this directory
  3. # Rm-rf python // The python file is a soft connection file pointing to the python installed by default.
  4. # Ln-s Python_HOME/Python-2.7.3/python.exe./python // Python_HOME unzip the python directory for you and create a new connection file pointing to the newly installed Python
  5. # Python // test. if the version is python-2.7.3, the installation is successful. See figure 4)




3. Configure the python integrated development environment (IDE) in windows)

Many of my friends who use python are directly developed in the vim editor. They said that the vim editor is very powerful and I have been using it for a while, however, I really don't like the black box, and I feel too monotonous, and I feel that the functions are not as powerful as they say. Maybe I still don't know the power of vim. Another reason is: I am a java programmer. I have been using Eclipse since my freshman year, and I have an inexplicable sense of intimacy with the Eclipse development environment. In addition, for Python, the best open-source IDE is now a combination of Eclipse and PyDev (http://pydev.org) plug-ins (which is not free ). -- From Python Advanced Programming

1. Install the PyDev plug-in Eclipse 

1) Installation Method 1:
Go to the yoxos website to customize the Eclipse compressed package with the pydev plug-in. decompress the package and use it. You can also customize Eclipse with other plug-ins, such as android, as shown in Figure 5)



2) Installation Method 2:
Use Eclipse to Install the plug-in and go to Help-> Install New Software. Just click next. You know, see Figure 6)


3) Installation Method 3:
Directly download PyDev, I downloaded it on CSDN, the version number is PyDev-2.6.0, unzip (figure 7 ), copy the files under the plugins and features directories to the plugins and features directories of Eclipse respectively. Open Eclipse again and then OK.


2. Configure Python Interpreters

1) Open Eclipse-> Preferences and search for interpreter, as shown in figure 8)


2) Click Auto Config to automatically search for Python. The configuration is complete, as shown in Figure 9. Click OK.


(Note: If your Eclipse path contains Chinese characters, an error will be reported in this process. See figure 10. You only need to change the Chinese character in the path to English. This problem has made me go over for a long time and I must discuss it out)



Specific error:


Java code
  1. Unable to gather the needed info from the system.
  2. This usually means that your interpreter is not in
  3. The system PATH.
  4. Com.sun.org. apache. xerces. internal. impl. io. MalformedByteSequenceException: Invalid byte 2 of 2-byte UTF-8 sequence.


4. Create a Python Project

1. Select the PyDev Project, as shown in Figure 11)



2. Enter the project name and click finish. A Python project is successfully created, as shown in Figure 12)



3. Create a project, as shown in Figure 13)



5. Compile HelloWorld 

1. Create the pyDev Module under the pyTest package, as shown in figure 14)



2. Compile helloworld. py with an automatic prompt. The encoding is so happy. Run the program (Run As-> Python Run) and print helloworld. See Figure 15)



6. Summary:

Now Python installation and configuration are complete, and we can develop it happily in this integrated development environment. I believe you will like Python. I will also keep writing articles related to the new Python, so I have to look forward to it ···

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.