Python

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
第45行: 第45行:
 
==Python应用==
 
==Python应用==
 
*[[Python and Math]]
 
*[[Python and Math]]
 +
===Python and Grid===
 +
*[[Python Core]] - http://dev.globus.org/wiki/Python_Core
 
==Python IDE & Editor==
 
==Python IDE & Editor==
 
*[[Vim]]
 
*[[Vim]]

2007年2月21日 (三) 16:40的版本

Python-logo.gif

Python 最新版:2.5 , 下载最新版: http://download.huihoo.com/python/

Python 是一种面向对象的解释性的计算机程序设计语言,也是一种功能强大而完善的 通用型语言,已经具有十多年的发展历史,成熟且稳定。

Python-powered-w-100x40.png

At Google, python is one of the 3 "official languages" alongside with C++ and Java. Python at Google, Google Group, code.google.com 等服务基于 Python 构建。

Python 2.4.4 (#1, Feb  3 2007, 09:56:56) 
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 'Ruby' > 'Python'
True
>>> 'Ruby' > 'Java'
True
>>> 'Ruby' > 'C/C++'
True

有点意思 :)

目录

版本

Python应用/框架

更多: Huihoo Python Applications

Python应用

Python and Grid

Python IDE & Editor

更多 IDEs: http://wiki.python.org/moin/IntegratedDevelopmentEnvironments

pygame

Python Enhancement Proposals(PEPs)

PEPs 有点类似 Java JSRs

更多 PEPs : http://www.python.org/dev/peps/

Linux

Python 2.3 on Debian

Debian 3.1 安装后自带 Python 2.3

Python 2.4 on Debian

wget http://www.python.org/ftp/python/2.4.4/Python-2.4.4.tgz
tar zxvf Python-2.4.4.tgz
cd Python-2.4.4
./configure 
make
make install // installed to /usr/local/lib/python2.4
/usr/local/bin/python2.4
Python 2.4.4 (#1, Feb  3 2007, 09:56:56) 
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Python 2.5 on Debian

wget http://www.python.org/ftp/python/2.5/Python-2.5.tgz
tar zxvf Python-2.5.tgz
cd Python-2.5
./configure 
make
make install 

Solaris

FreeBSD

FreeBSD 6.1 安装有 Python 2.4.2

Windows

http://download.huihoo.com/python/2.5/python-2.5.msi
set path=%path%;C:\Python25

运行命令行或集成开发环境 IDLE

>>> help()
help>modules 
help>sys
help>modules search 
help>SearchEngine
help>modules hash
help>hashlib
help>quit
>>>

获得 mod_python , http://www.apache.org/dist/httpd/modpython/win/

http://www.apache.org/dist/httpd/modpython/win/3.3.0b/mod_python-3.3.0b.win32-py2.5-Apache2.2.exe
会被安装到 C:\Python25\Lib\site-packages\ 
并在安装过程中提示输入 Apache 的位置, C:\apache-2.2.3
mod_python.so 被添加到 C:\apache-2.2.3\modules

修改 httpd.conf

LoadModule python_module modules/mod_python.so
<Directory "C:/myweb">
  SetHandler mod_python
  PythonHandler mod_python.publisher
</Directory>

创建index.py文件

def index(name):
  return "Welcome %s" % name   
http://localhost/python/?name=huihoo (OK :)

下载 mod_python example

http://www.modpython.org/examples/psp_site.tgz 
http://localhost/psp_site/

Database

DB-API 标准

MySQL

http://sourceforge.net/projects/mysql-python/

获得 MySQL-python.exe-1.2.1_p2.win32-py2.4.exe 
包安装到 C:\Python24\Lib\site-packages\MySQLdb 
>>> import MySQLdb
>>> db = MySQLdb.connect("localhost","root","password","mysql")
>>> cursor = db.cursor()
>>> sql = "select * from db"
>>> cursor.execute(sql)
>>> data = cursor.fetchone()
>>> print data
>>> db.close()

PostgreSQL

SQLite

http://pysqlite.org/

ORM

Modules

Python Modules

相关链接

联机文档

Python Web Services

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱