Python advanced Programming (1)-Preparing for work

Source: Internet
Author: User

1.1 Installation 18

The version here is 2.7.9;https://www.python.org/downloads/release/python-279/

installation MinGW: For the development of Windows platform compiler, there are various functions of GCC, instead of VC + +;

http://www.mingw.org/

http://sourceforge.net/projects/mingw/files/Installer/

Download Mingw-get-setup.exe;

installation to D:\Pythons\MinGW;

Run the Mingw-get.exe in the bin directory and tick all the packages under MinGW Compiler Suite (no full selection);

Menu Bar Installation->apply

then download and install;

Download will take a long time, and every now and then because not connected to the SourceForge and interrupted, failed to re-download the installation can be, after installation look at D:\Pythons\MinGW\bin, there are many old tools;

D:\Pythons\MinGW\bin is added to the environment variable; validation, command line execution gcc-v;python The compiler will automatically call when required;

installation MSYS

Msys can provide a Bourne shell command-line execution environment on the Windows platform; the Bourne shell is a standard UNIX shell, which is bash;

This environment can be implemented in Linux or Mac OS X operating system common commands, such as CP, RM, etc.;

There is no need to download here, MinGW inside, installation is possible;

After installing MinGW and Msys, the main functions of Linux are available in Windows;

1.2 Command line 25

9:29

command line input python into the command line, example: small computing, such as 1+3;

Press ENTER,python immediately resolves the program and returns the result , which is inherited from the ABC language;

ABC language is a teaching language, designed for non-professional programmers;

Exit command line: Windows,ctrl+z (then enter); linux/mac,ctrl+d;

1.2.1 Customizing interactive command line 26

9:36

By starting the file configuration, the environment variable Pythonstartup will be found at startup to execute the code in the file;

The default is a. Pythonstartup in the home directory; function: Tab auto-complete, command history;

This is implemented based on the ReadLine module (requires ReadLine library);

See if Python has the ReadLine module installed;

Command line Input: Help (), then enter modules;

Look at the hint can also search; input modules ReadLine;

There is a mini version of the ReadLine;

. Pythonstartup, can go to https://pypi.python.org/pypi/pbp.scripts, download;

"G:\pbp.scripts-0.2.5\pbp\scripts\pythonstartup.py"

pythonstartup.py renamed to. Pythonstartup;

But not renamed:

Okay, keep the original. Try, configure environment variables;

Then enter the command line;

Hint no readline module;

Download and install, http://newcenturycomputers.net/projects/readline.html

Readline-1.7.win32-py2.6.exe

Install ReadLine;

See if Python is 32-bit or 64-bit, which can be seen when the command line enters;

The previous ReadLine problem is that the 27 version is installed and the registry does not have a 26 version;

Plus, regedit,

Hkey_local_machine\software\wow6432node\python\pythoncore\2.6\installpath

Re-install:

Installation completed;

Traceback (most recent):

File "D:\Python27\pythonstartup.py", line 2, <module>

Import ReadLine

File "D:\Python27\lib\site-packages\readline.py", line +, in <module>

Import sys, OS, MSVCRT, _rlsetup

Importerror:dll load failed: The specified module could not be found.

Checked online, under Windows Python 2.7, ReadLine is not valid under Windows.

Install a pyreadline;

Execute pip install pyreadline;

It seems that the installation module can use PIP install;

Authentication

Delete the environment variable, perhaps this pyreadline does not have the configuration file at all;

TAB Auto-completion does not take effect;

os.environ[' Home ' keyerror: ' Home ' because the Windows environment does not have a home environment variable, corresponding to the HomePath;

Execution: Import OS

Os.environ.keys () can be viewed;

Then change to HomePath suppress;

Verify:

OK!!!!!!!!!

Nima

Put a module all this hole dad!

Summary: To use tab auto-completion, version 27 installs pip install pyreadline,pythonstartup.py content:

http://git.oschina.net/yejq/PythonRel/blob/master/conf/pythonstartup-windows.py

1.2.2 IPython: Enhanced command-line 27

Extended command line:

· Dynamic object reflection;

· Invoking the system Shell function on the command line;

· Direct support for program tuning;

· Debugging tools;

Installation: Pip Install Ipython

1.3 Installing Setuptools 28

Setuptools: Package management system, publish Python application, equivalent to Debian in the apt;

PyPI (Python package Index): Centralized warehouse;

is not the standard library, but also to install;

1.3.1 Installation with Easyinstall

Easyinstall seems to have been installed;

"D:\Python27\Scripts\easy_install.exe"

See if there are any setuptools installed;

It seems to have been installed;

1.3.3 integration of MinGW into Distutils 31

When the program needs to be compiled, the D:\Python27\Lib directory can be created; distutils.cfg;

Content:

[Build]

compiler = Mingw32

This makes it possible to link MinGW to Python, and each time Python needs to compile a package containing C program code, it automatically calls MinGW;

1.4 Working Environment 31

Here I use pycharm-professional-4.0.4;

1.4.1 Vim installation and Configuration 33

The book recommended using Vim;

Start the MinGW shell to see if it is installed;

Input vim-version;

Not installed;

In MinGW installation MANAGER,MSYS,MINGW Developer toolkit inside can be found;

Install it; the old connection failed, re-installed several times;

can also install gvim;

Here too lazy to match, long live the party, with a big God on the Internet green version;

http://www.oschina.net/code/snippet_574132_13357

1.4.2 IDE

Install eclipse with Pydev plug-in;

Marketplace;

Install it;

Not even up;

Try the install Updates;

Http://pydev.org/updates

Go to this URL: https://dl.bintray.com/fabioz/pydev/all/

Python advanced Programming (1)-Preparing for work

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.