Common python modules and installation methods

Source: Internet
Author: User
Tags image processing library xml parser ftp client ftp protocol wxwidgets

Http://chen-gengjia.iteye.com/admin/blogs/new

 

Adodb: database connection component recommended by our leaders
Bsddb3: BerkeleyDB connection component
Cheetah-1.0: I prefer this version of cheetah.
Cherrypy: a web framework
Ctypes: used to call the dynamic link library
DBUtils: Database Connection Pool
Django: a web framework
Docutils: used to write documents
Dpkt: unpackage and group package
MySQLdb: connection to the MySQL database
Py2exe: used to generate windows executable files
Pylons: web framework recommended by our leaders
Pysqlite2: connection component of SQLite
Pythonwin: Python Windows Extension
Setuptools: a python package management mechanism for PEAK
Sqlalchemy: Database Connection Pool
SQLObject: Database Connection Pool
Twisted: a network programming framework
WxPython-2.6: the GUI programming framework is not up to date because it requires the same version as linux
Pypcap: Packet Capture
Python-dnet: other devices that Control Network Security
Pyevent: Python event support
Pydot: graph, graphiz
Sendpkt: Python package
Simplejson: JSON support

DPKT: raw-scoket Network Programming
Cx-oracle: a good connection to oracle
Machize: Commonly Used crawlers to connect to websites
PIL: Image Processing Toolkit

Reportlab for PDF file.
PyQt4 for GUI
Feedparser: rss Parsing
Chardet: encoding Detection
Scons: the project construction tool. It is very convenient to use the template.
Scapy: Network Package Build Analysis Framework, programmable wireshark, interested google "Silver Needle in the Skype"
Pefile: windows pe file parser
Winpdb: It depends on your own program or when you cannot understand it in other libraries.
Pywmi: saves a lot of effort
Pylint: cultivate good coding habits

The following is intended for use without comments:
Pygccxml
Pyparsing
Pymacs
Idapython
Paimei
Pysvn
PyLucene
Wikidpad

1. Karrigell http://karrigell.sourceforge.net/
1. http://effbot.org/librarybook/ of The Standard Python Libary
1. Libary http://reportlab.org for Python operations PDF/
1. Python cURL Libary http://pycurl.sourceforge.net/
1. urlgrabber http://linux.duke.edu/projects/urlgrabber/
1. MySQL-Python http://mysql-python.sourceforge.net/
1. pyScripter
2. Python for Delphi http://mmm-experts.com/Products.aspx
1. Python Cookbook http://aspn.activestate.com/ASPN/Python/Cookbook/
1. pygame http://www.pygame.org/news.html
1. pymedia http://www.pymedia.org
1. Python http://dbfpy.sourceforge.net/
1. Pexpect http://pexpect.sourceforge.net/
1. dabo
Desktop application frameworks http://dabodev.com/

1. pySerial
Http://pyserial.sourceforge.net/
Http://wiki.woodpecker.org.cn/moin/PySerial
1. python's doc
Http://wiki.woodpecker.org.cn/moin/PythonZhDoc
1. The Visual Module of VPython (3D)
Http://vpython.org/index.html
1. PyLucene
Http://pylucene.osafoundation.org/
1. DBUils
Http://www.webwareforpython.org/DBUtils
1. http://happyiww.popo.blog.163.com/blog/
A good people's blog
1. AppleScript, component components, HtmlCalendar
Http://freespace.virgin.net/hamish.sanderson/index.html
1. Pypcap
Http://code.google.com/p/pypcap/
Http://monkey.org /~ Dugsong/dpkt/
Http://www.winpcap.org/install/default.htm

Python-memcached client module for memcached
Kodos, python Regular Expression debugging tool,
PLY (Python Lex-Yacc)
Http://www.dabeaz.com/ply/
Writing assembler using it.
WxPython-GUI Framework
OmniORBpy-CORBA Library
ZODB3-an OODB implement
ReportLab-PDF generating solution
Numpy + scipy + matplotlib

Analysis of various multimedia metadata in hachoir
Python-orge demo
Database:
Sqlalchemy
Sqlobject
MySQL-python (this name is used when easy_install is used)

Routes
Beaker
Two template engines:
Genshi
Mako
Paster

Also known
PyCrypto encrypted
Paramiko can help you write sftp, which is better than the one in twisted.
Twisted write Server
PyOpenGL
PyGame
The legend of Psyco can accelerate your python Program
PIL (Python Image Library) processing images
PyObjC is used by Apple to write Cocoa programs.

Python desktop client GUI application:
WxPython
PyOpenGL
PyXML
ZSI
Davlib. py
ChartDirector
A chart library that supports multiple languages is better than jfreechart in terms of effect and efficiency.

##################
Game 3D pyglet, pythonOgre, blender (c), k-3d (c ++), vpython, panda3d
========================================================== ========
Collect the jbj of catswhocode.com In the python package

Graphical interface wxPython http://wxpython.org
Graphical interface pyGtk http://www.pygtk.org
Graphical interface pyQT http://www.riverbankcomputing.co.uk/pyqt/
Graphical interface Pmw http://pmw.sourceforge.net/
Graphical interface Tkinter 3000 http://effbot.org/zone/wck.htm
Graphical interface Tix http://tix.sourceforge.net/

Database MySQLdb http://sourceforge.net/projects/mysql-python
Database PyGreSQL http://www.pygresql.org/
Database gadgets http://gadfly.sourceforge.net/
Database SQLAlchemy http://www.sqlalchemy.org/
Database psycopg Co., http://www.initd.org/pub/software/psycopg/.
Database kinterbasdb http://kinterbasdb.sourceforge.net/
Database cx_Oracle http://www.cxtools.net/default.aspx? Nav = downloads
Database pySQLite http://initd.org/tracker/pysqlite

MSN Messenger msnlib http://auriga.wearlab.de /~ Alb/msnlib/
MSN Messenger pymsn http://telepathy.freedesktop.org/wiki/Pymsn
MSN Messenger msnp Co., http://msnp.sourceforge.net/
Networks Twisted http://twistedmatrix.com/
Images PIL http://www.pythonware.com/products/pil/
Images gdmodule http://newcenturycomputers.net/projects/gdmodule.html
Images VideoCapture http://videocapture.sourceforge.net/

Scientific and Maths scipy http://www.scipy.org/
Scientific and Maths NumPy http://numpy.scipy.org //
Scientific and Maths numarray http://www.stsci.edu/resources/software_hardware/numarray
Scientific and Maths matplotlib http://matplotlib.sourceforge.net/

Games Pygame http://www.pygame.org/news.html
Games Pyglet Co., http://www.pyglet.org/
Games PySoy http://www.pysoy.org/
Games pyOpenGL Co., http://pyopengl.sourceforge.net/

Jabberpy http://jabberpy.sourceforge.net/

Web scrape http://zesty.ca/python/scrape.html
Web Beautiful Soup http://crummy.com/software/BeautifulSoup
Web pythonweb http://www.pythonweb.org/
Web mechanics http://wwwsearch.sourceforge.net/mechanize/

Localisation geoname. py http://www.zindep.com/blog-zindep/Geoname-python/

Serial port Python http://pyserial.sourceforge.net/
Serial port USP http://ibarona.googlepages.com/uspp

Parallel Port pyParallel http://pyserial.sourceforge.net/pyparallel.html

USB Port pyUSB http://bleyer.org/pyusb/

Windows ctypes http://starship.python.net/crew/theller/ctypes/.
Windows pywin32 http://sourceforge.net/projects/pywin32/
Windows pywinauto http://www.openqa.org/pywinauto/
Windows Python http://pyrtf.sourceforge.net/
Windows wmi http://timgolden.me.uk/python/wmi.html

PDA/GSM/Mobiles pymo http://www.awaretek.com/pymo.html
PDA/GSM/Mobiles pyS60 http://sourceforge.net/projects/pys60

Sound pySoundic http://pysonic.sourceforge.net/
Sound pyMedia http://pymedia.org/
Sound FMOD http://www.fmod.org/
Sound pyMIDI http://www.cs.unc.edu/Research/assist/developer.shtml

GMail libgmail http://libgmail.sourceforge.net/
Google pyGoogle http://pygoogle.sourceforge.net/
Secondary CT pyExpect http://pexpect.sourceforge.net/
WordNet pyWordNet http://osteele.com/projects/pywordnet/
Command line cmd http://blog.doughellmann.com/2008/05/pymotw-cmd.html
Compiler backend llvm-py http://mdevan.nfshost.com/llvm-py/
3 D VPython http://vpython.org
Encryption

PyDes DES encryption and decryption module http://twhiteman.netfirms.com/des.html
 
 
Parsing pyparsing is similar to lex/yacc but simpler lexical/syntax analyzer pyparsing.wikispaces.com

Tkinter ---- default graphical interface of Python.
Tkinter is a Python module with Tk interfaces. The Tkinter Library provides interfaces for Tk APIs, which belong to the GUI tool group of Tcl/Tk. Tcl/Tk is a writing and graphics device developed by John Ousterhout. Tcl (tool command language) is a macro language used to simplify the development of complex programs in shell. Tk Toolkit is developed with Tcl to simplify the design process of user interfaces. The Tk toolkit consists of many different widgets, such as a button and a scroll bar. With these widgets provided by Tk, we can quickly launch a GUI. Perl, Scheme, and other languages also use the Tk library for GUI development. Tkinter is cross-platform and can be used on various platforms.
Python Imaging Library (PIL)-python provides powerful graphic processing capabilities and supports a wide range of graphic file formats. This Library can convert, print, and display graphic formats. It can also process some graphic effects, such as scaling up, downgrading, and rotating. It is a powerful tool for Python users to perform image processing.
Pmw (Python megawidgets) Python super GUI component set-an advanced GUI component built using the Tkinter module in python. Each Pmw combines one or more Tkinter components, to achieve more useful and complex functions.
PyXML-a toolkit for parsing and processing XML documents using Python. The 4DOM in the package is fully compatible with W3C DOM specifications. It contains the following content:
Xmlproc: a compliant XML parser.
Expat: a fast, non-verified XML parser. There are other
At the same level as him, there is also PyHtml PySGML.
PyGame-A module used for multimedia development and game software development.
PyOpenGL-the module encapsulates the "OpenGL Application Programming Interface", through which python programmers can integrate 2D and 3D graphics in the program.
NumPy, NumArray, and SAGE ---- NumArray is an extension library of Python. It is mainly used to process fixed arrays of any dimension. In short, it is a matrix library. Its low-level code is written in C, so the speed advantage is obvious. NumPy is the successor of Numarray, used to replace NumArray. SAGE is a mathematical software package based on NumPy and several other tools. It aims to replace Magma, Maple, Mathematica and Matlab.
MySQLdb module ---- used to connect to the MySQL database. The ZMySQLDA module for zope can be used to connect to the mysql database in zope.
PyGTK-GTK + Library Used for python GUI program development. GTK is the library used to implement GIMP and Gnome. With it, you can confidently try making your own Photoshop.
PyQt-the Qt development library for python. QT is the database that implements the KDE environment. It consists of a series of modules, including qt, qtcanvas, qtgl, qtnetwork, qtsql, qttable, qtui and qtxml, contains 300 classes and more than 5750 functions and methods. PyQt also supports a module called qtext, which contains a QScintilla library. This library is the Qt interface of the Scintillar editor class.
PyMedia-python module for multimedia operations. It provides rich and simple interfaces for multimedia processing (wav, mp3, ogg, avi, divx, dvd, cdda etc ). It can be used on Windows and Linux platforms.
Psyco-a Python code accelerator that increases the speed of Python code execution to the same level as the compiling language.
Python-ldap-provides a set of object-oriented APIs to conveniently access the ldap directory service in python, which is based on OpenLDAP2.x.
Smtplib module-send an email.
Ftplib module ---- defines FTP classes and some methods for ftp programming on the client. We can use python to compile an ftp client program for downloading files or image sites. For more information about the ftp protocol, see RFC959.
The xmpppy module-The Jabber server adopts the developed XMPP protocol, and Google Talk is also an IM system using the XMPP protocol. In Python, an xmpppy module supports this protocol. That is to say, we can use this module to communicate with the Jabber server. Is it Cool.
Address: http://xinsync.xju.edu.cn/index.php/archives/4401
========================================================== ====

Several third-party Python libraries I commonly use)
XPython

If you are a windows programmer and use MFC or WIN32API to develop the interface program, the best GUI option for entering the Python country should be wxPython. It is the Python Bind of wxWidgets, which is perfectly synchronized with wxWidgets development. The most important thing is that its message mechanism is quite similar to that of MFC, previous experiences in MFC can be applied to wxPython with slight changes. In WIN32 development, the most annoying part must contain the WM_SIZE message. It is troublesome to keep the control layout in WIN32 when the size of the Main Window changes. The wx solution is perfect, and its sizer concept allows me to easily maintain a perfect control layout with different window sizes. In addition, if you hate the doc-view model of MFC, wx can also give you a new option. If you like the doc-view model very much, rest assured, it can still be easily implemented in wx, and the previous ideas can still be used here.
WxPython has two packages: PythonCard and dabo. The former is a limited package of wxPython and does not support all features of wxPython. Its goal is to make wxPython more Pythonic. The latter is much larger than PythonCard. Specifically, it should be a three-tier C/S mode development framework. If you want to develop database-based applications (such as MIS and ERP), using dabo is a good choice. In addition, if you are used to RAD development environments such as VB, VFP, and Delphi, dabo is not much worse than these expensive tools!

Py2exe

According to the evil windows thinking, if an application is not compiled. exe files may not be "software", and py2exe serves your purpose. py script.. zip file, but you can also modify setup. the py script packages all the scripts and dependent dll files into one exe. It looks like the program compiled by VC and VB is no different!
If your customers need to use your applications in windows, py2exe is an indispensable tool. I use it to package gadgets written by wxPython for game planning in the company.

Psyco

The execution efficiency of the script is somewhat unsatisfactory. Although optimization is not difficult, it is worth noting if there is a simple method that almost does not need to modify the source code. The magic of psyco is that it only needs to call two lines of code at the entrance of the code, and the performance can be improved by 40% or more, which is truly immediate!
If your customer thinks your program is a little slow, don't rush to optimize the code. psyco may let him change his mind immediately. Psyco is called the Python jit and has a lot of potential to explore. If there is not much time to optimize the performance for you, please read its manual immediately. There are many ways to easily optimize the performance.

PIL

PIL is a Python image processing library. In my opinion, PIL is so powerful that it is not easy to say. It can open dozens of image formats, including jpg, png, and bmp. In addition, it also provides many image processing functions, such as enhancement and filtering algorithms, for more information, see my previous article "using Python for image processing" (http://blog.csdn.net/lanphaday/archive/2007/10/28/1852726.aspx) and "calculating image similarity" (http://blog.csdn.net/lanphaday/archive/2008/04/24/2325027.aspx ).

MySQLdb

This is Python's support for the open-source Mysql database. The official website is http://sourceforge.net/projects/mysql-python. Supports the full range of Mysql 3.23-5.1 and Python 2.3-2.5. MySQLdb is the implementation of Python DB API-2.0, and it is very mature now. The latest version is 1.2.2.
If you are engaged in server development, you should not deal with the database connection pool. In this case, you can use DBUtils or jonpy open-source libraries. Among them, DBUtils is a set of database connection pool libraries, while jonpy includes CGI and database connection pool among other functions. Please read the manual and select your own library.

Pyprocessing
The GIL (Global interpreter lock) in the Python interpreter makes Python a bit awkward in the multi-core era-The scripting language that supports native threads cannot utilize multiple CPU cores for concurrent computing through multithreading. Pyprocessing does not try to remove GIL. Instead, pyprocessing tries to use multi-process methods to help Python get out of the predicament. The result is that the use of pyprocessing to create communication between processes is not only as simple as the use of the built-in threading module, or even easier. Pyprocessing not only can communicate with the pipeline through the local socket, but also can be encapsulated perfectly. Its Queue implementation is no different from the built-in Queue implementation, but it is a queue shared between processes!
Pyprocessing has been used as a built-in module in py2.6 and py3.0. It is also an affirmation of the development community for the pyprocessing project. If you use Python to develop server applications, especially those such as online games, how can you ignore pyprocessing!

========================================================== ============================================

Python module Installation
1. Single file module
Directly copy the file to $ python_dir/lib.

2. Multi-file module with setup. py
Python setup. py install

3. egg File
1) download ez_setup.py and run python ez_setup
2) easy_install *. egg
Although Python modules can be copied and installed, it is generally recommended to create an installation package, that is, to write a setup. py file for installation.
Use of the setup. py file:

% Python setup. py build # compile
% Python setup. py install # install
% Python setup. py sdist # create a distribution package
% Python setup. py bdist_wininst # create a distribution package in windows
% Python setup. py bdist_rpm

Compiling the setup. py file
In setup. py, you mainly execute a setup function. Most of this function is descriptive. The most important parameter is the packages parameter, which lists all packages. You can use the built-in find_packages to dynamically obtain the package. Therefore, writing the setup. py file is actually very simple.
Simple Example:
Setup. py file

From setuptools import setup, find_packages
Setup (
Name = "mytest ",
Version = "0.10 ",
Description = "my test module ",
Author = "Robin Hood ",
Url = "http://www.csdn.net ",
License = "lgpl ",
Packages = find_packages (),
Scripts = ["scripts/test. py"],
)

Mytest. py

Import sys
Def get ():
Return SYS. Path

Scripts/test. py

Import OS
Print OS. environ. keys ()

In setup, scripts indicates that the file is placed in the Scripts directory of Python and can be directly used.
OK. You can run the commands listed to generate the installation package or install the python package.

Local test successful (win32-python25 )!
========================================================== ======================================
Setuptools can automatically install the module. You only need to provide it with a module name, and it will automatically help you solve the module dependency problem. Generally, the modules installed with setuptools are automatically put in a directory with the suffix. egg.

First, install the setuptools thing, first download a script: After the http://peak.telecommunity.com/dist/ez_setup.py download directly execute it will help you set up setuptools.
Then, the installation module uses the easy_install command. In Windows, this command is in the scripts under the python installation directory, therefore, you need to add scripts to the PATH of the environment variable, which is more convenient to use. You do not need to pay attention to this issue in linux.
To install the software, run the easy_install Module name.
========================================================== ==============
Pyinstaller to create python independent execution files in linux

The following assumes that Python 2.4/2.5 has been installed.
1. Download and compile the pyinstaller (you only need to do it once, and you can directly do the second step in the future)
1. Download pyinstaller. The current version is 1.3.
(1) wget http://pyinstaller.hpcf.upr.edu/source/1.3/pyinstaller_1.3.tar.gz

2. Unpack the package to the source code directory.
(1) tar zxv pyinstaller_1.3.tar.gz
(2) cd pyinstaller-1.3/source/linux

3. Compile source code
(1) python Make. py generates the python. pyc File
If no error exists, the following prompt is displayed (only one row exists ):
Now run "make" to build the targets: http://www.cnblogs.com/support/loader/run http://www.cnblogs.com/support/loader/run_d
(2) make connection to generate the. o file for linux

4. Generate the compilation configuration file
(1) generate config. dat configuration file in python Configure. py

2. Compile a python executable file that runs independently
1. Generate the spec File
Python pyinstaller-1.3/Makespec. py -- onefile -- upx linuxlaptop. py

Parameter description:
-- Onefile: generate a single file
-- Upx generates compressed files (which can reduce the volume of execution files. You need to install the upx package first)
2. Generate the final Executable File
Python pyinstaller-1.3/Build. py linuxlaptop. spec

After execution, an executable linuxlaptop file will be generated in the current directory. If you have any questions, please contact me: linuxlaptop.cn.
========================================================== ======================================
Package python into an exe executable file with cx_Freeze

I have never tried to package Python before. I tried it yesterday and found that packaging is quite easy. python packaging has many options. cx_Freeze is one type, and py2exe can also be used. There is also a pyinstaller. I use cx_Freeze, and py2exe cannot be connected because sf is too slow. so there is no way, so you have to download it first. cx_Freeze has less information, but it is not too painful, because it seems that cx is easier to use than py2exe, and it seems to be cross-platform, good and good.
Cx_freezeis a command to use freezepython.exe, which can be quickly packaged:
FreezePython.exe -- install-dir = "/your/path/to/install" app. py
Then, the app. py and all the modules on which it depends, the packages and libraries will be reorganized and put under the path specified by -- install-dir.
We encountered two problems: file encoding. At first, we always said that we could not find the gb2312 encoding. Later we Googled and found that we needed to do this:
Add the from encodings import gbk statement to app. py, and then you can.
If gettext is used, pay attention to
"Content-Type: text/plain; charset = gbk \ n"
"Content-Transfer-Encoding: cp936 \ n"
These two statements must be written in this way. The character set must use gbk instead of gb2312.
Another problem is console hiding:
By default, cx_Freeze is a console program after packaging. Even if you Package A wxPython program, there will also be a black console behind the background. To remove the console, you should do the following:
FreezePython.exe -- install-dir = "\ your \ install \ path" --base-binary#win32gui.exe app. py
After -- bash-binary is added, you can only run the front-end interface. However, if a program error occurs, an error dialog box is displayed, indicating that the traceback module cannot be found.
Add the following to the app. py file:
Import traceback

The error feedback is displayed in a dialog box.

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.