linux上安装python服务器相关工具
1、升级系统
yum check-update
yum update
2、安装一些常用的工具
yum install ntp iptraf sysstat screen subversion wget bzip2 nfs-utils vim-common
3、设置每天自动核准时间
# crontab -e
0 * * * * /usr/sbin/ntpdate 210.72.145.44
:wq
4、安装一些开发包
# yum install make gcc gcc-c++ libjpeg-devel libpng-devel zlib-devel tcl-devel freetype-devel libevent-devel openssl-devel db4-devel curl-devel pcre-devel ncurses-devel readline-devel sqlite-devel bzip2-devel
5、安装sqlite
wget http://www.sqlite.org/sqlite-3.6.4.tar.gz
tar xzvf sqlite-3.6.4.tar.gz
cd sqlite-3.6.4
./configure --enable-threadsafe
make
make install
5、安装Python
wget http://www.python.org/ftp/python/2.5.4/Python-2.5.4.tar.bz2
tar xjvf Python-2.5.4.tar.bz2
cd Python-2.5.4/
./configure --enable-unicode=ucs4
make
make install
6、安装MySQL 5.0
wget http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.83.tar.gz/from/http://mysql.mirrors.pair.com/
tar xzvf mysql-5.0.83.tar.gz
cd mysql-5.0.83/
groupadd mysql
useradd -g mysql mysql
mkdir /opt/mysql-data
CFLAGS="-O3 -march=nocona" CXX=gcc CXXFLAGS="-O3 -march=nocona -felide-constructors \
-fno-exceptions -fno-rtti" ./configure \
--prefix=/usr/local/mysql --enable-assembler \
--with-charset=utf8 \
--with-extra-charsets=gbk,gb2312,latin1 \
--localstatedir=/opt/mysql-data \
--with-mysqld-user=mysql --enable-large-files --with-big-tables \
--without-debug \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static \
--enable-thread-safe-client \
 
相关文档:
client:
import socket, sys
if __name__ == '__main__':
#处理参数
argv = sys.argv
if (len(argv)!=3) or (len(argv)==2 and argv[1]=='/?'):
print '>>>Useage:', argv[0], '<address> < ......
客户给一堆图片要传到后台,图片太大了,上百张图用photoshop改太慢,就想到用python写个简单的批处理。功能简单就是把原图按比例缩小,代码更简单 20多行。
# -*- coding: cp936 -*-
import Image
import glob, os
#图片批处理
def timage():
for files in glob.glob('D:\\1\\*.JPG'):
filepath,filena ......
模块
一.简介
模块基本上就是一个包含了所有你定义的函数和变量的文件。为了在其他程序中重用模块,模块的文件名必须以.py为扩展名。
例如:
#!/usr/bin/python
# Filename: using_sys.py
import sys
print 'The command line arguments are:'
for i in sys.argv:
print i
print '\n ......
#coding=utf-8
from newtest.wiki.models import WiKi
from django.template import loader, Context
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
def index(request, pagename=""):
"""显示正常页面,对页面的文字做特殊的链接处理"""
......