I. Customizing the interactive prompt for Python
The default interactive prompt for Python is ">>>", but it can be customized.
After Python starts, look for the PYTHONSTARTUP environment variable and execute the execution code specified by the variable in this file.
Some Linux distribution packages provide default startup scripts, which are typically stored in their home directory, named. Pythonstartup. The two features of tab completion and command history enhance the prompt application, both based on the ReadLine module.
If you do not have a. pythonstartup file, you can create one yourself.
Simple example:
Copy the Code code as follows:
# Python startup file
Import ReadLine
Import Rlcompleter
Import atexit
Import OS
# tab Completion
Readline.parse_and_bind (' Tab:complete ')
# History File
Histfile = Os.path.join (os.environ[' HOME '), '. Pythonhistory ')
Try
Readline.read_history_file (Histfile)
Except IOError:
Pass
Atexit.register (Readline.write_history_file, Histfile)
Del os, Histfile, ReadLine, Rlcompleter
You can save As. Pythonstartup in Http://pypi.python.org/pypi/pbp.scripts.
Setting Pythonstartup Environment variables
If you are running Python under Linux or Mac OS X, the simplest way is to create a startup script and save it to your home directory.
Then connect it with the PYTHONSTARTUP environment variable and set it to the system startup script. For example, in bash and Korn shells, you can use the. profile file, which allows you to insert rows such as:
Export Pythonstartup=~/.pythonstartup
Under Windows, it is more convenient to set Pythonstartup golden variables.
Second, IPython
Ipython See: http://ipython.scipy.org
The goal of Ipython is to create a comprehensive environment for interactive applications and research calculations. There are two main components of the Ipython:
1) An enhanced Python interactive shell
2) interactive Parallel Computing architecture
Ipython Open Source, current version: 0.9.1. It is a python-enhanced shell. Characteristics:
-Dynamic Object Checking
-Access the system shell from the prompt
Direct support for-profiling
-Easy Commissioning
Third, Python's distutils
Python comes with a set of tool distutils for publishing python applications. It provides:
1, a skeleton
Provides standard metadata fields such as author name, license type, and so on.
2, a set of helper
Understand how to build a release package.
Distutils does not provide the ability to define other dependent packages, which is enhanced by the Setuptools tool.
Setuptools framework, which is a sub-project of the Python Enterprise application Kit (PEAK). Setuptools replaces the standard Distutils library and adds a versioned package and dependency management to Python.
Perl users are more familiar with CPAN, while Ruby users are more familiar with Gems, Ez_setup tools that guide Setuptools and the accompanying Easy_install and "Cheeseshop" (Python package Inde X, also known as "PyPI") work together to achieve the same functionality. In addition, Setuptools allows us to wrap our library into a package called "egg", which is associated with Java? The JAR file is similar, but for Python.
To install Setuptools, use Easyinstall.
Easyinstall is a package downloader and installer. Easyinstall is a supplement to the Setuptools tool because it knows how to handle package creation.