python学习笔记1(安装环境搭建)
今天学习过程:
安装Python宏定义
http://www.xshell.net/python/Notepad_Python.html
安装notepad++控制台
http://www.tuicool.com/articles/fAvuaq
python - easy_install的安装和使用
http://www.cnblogs.com/huangjacky/archive/2012/03/28/2421866.html
然后就会在python的安装目录中生成scripts目录,其中有easy_install.exe
安装mysql驱动
easy_install mysql-connector-python
easy_install MySQL-python
连接数据库例子
import mysql.connector
conn = mysql.connector.connect(user='root', password='usbw',port = '3307', database='test', use_unicode=True)
cursor = conn.cursor()
cursor.execute('select * from guestbook where id = 5')
values = cursor.fetchall()
print values
cursor.close()
conn.close()
Python模块的安装方法:
1. 单文件模块:直接把文件拷贝到$python_dir/lib
2. 多文件模块,带setup.py:python setup.py install
网友评论