develop:python
문서의 이전 판입니다!
Python
Install
- on Debian Linux
# apt-get install python python-dev python-psycopg
우분투에서도 같은 방법으로 설치한다.
Web Framework
- Turbogears
- Install ⇒ 우선, Debian stable 에는 없기 때문에 testing 이나 unstable 을 소스리스트에 설정을 해야 한다. 혹시나 하고 Ubuntu Linux에는 있을까 해서 찾아보았지만 패키지가 없었다.
나중에 패키지가 포함이 되면 그때 해봐야겠다.
Tip
소스파일 인코딩 설정
파일의 상단에 다음과 같이 소스파일 인코딩을 설정한다.
# -*- coding: utf-8 -*-
cx_Oracle 설치
- Oracle Client 를 먼저 설치하여 환경변수를 설정한다
- python2.3-dev 를 설치한다. cx_Oracle 을 소스 컴파일하기 위해서 필요하다
# apt-get install python2.3-dev
- http://www.cxtools.net 에서 소스를 다운로드 한다.
# wget http://prdownloads.sourceforge.net/cx-oracle/cx_Oracle-4.2.tar.gz?use_mirror=jaist
- tar 를 풀고 빌드/설치한다.
# tar xvfz cx_Oracle-4.2.tar.gz # cd cx_Oracle-4.2 # python setup.py build # python setup.py install
- 코드 샘플
import cx_Oracle # connect via SQL*Net string or by each segment in a separate argument #connection = cx_Oracle.connect("user/password@TNS") connection = cx_Oracle.connect("user", "password", "TNS") cursor = connection.cursor() cursor.arraysize = 50 cursor.execute(""" select Col1, Col2, Col3 from SomeTable where Col4 = :arg_1 and Col5 between :arg_2 and :arg_3""", arg_1 = "VALUE", arg_2 = 5, arg_3 = 15) for column_1, column_2, column_3 in cursor.fetchall(): print "Values:", column_1, column_2, column_3
Link
Reference
Tip
develop/python.1170740664.txt.gz · 마지막으로 수정됨: 저자 mattabu
