码迷,mamicode.com
首页 > 编程语言 > 详细

PHP+Python,轻量维护超轻松

时间:2018-09-29 20:22:29      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:pymysql   and   mys   evo   host   数据   pre   pytho   local   

window下安装Python

直接去Python官网下载msi安装程序安装即可(选择自定义安装才能修改程序安装路径哦)

 

widows下Python的数据库访问模块PyMysql的安装

1.open the cmd execute the following command or enter "cmd /k "cd \PythonScriptPath\"" to a batch file and execute the batch
please replace the "PythonScriptPath" for your PythonScriptPath
C:\> cd \PythonScriptPath
2.use pip to install the pymysql
C:\> python pip.exe install pyMysql

 demo for use pymysql in cmd

命令执行的返回结果已省略

C:\>python
>>> import pymysql
>>> conn = pymysql.connect(host="localhost",user="root",password="root",db="test",charset="utf8mb4")
>>> cursor = conn.cursor()
>>> row = cursor.execute("select version()")
>>> print (row)
>>> result = cursor.fetchone()
>>> print (result)
>>> cursor.close()
>>> exit()

 

windows下PHP的Python扩展PPython的安装

到这里下载,里面有详细的使用说明:https://download.csdn.net/download/vancevol/10696481

PHP+Python,轻量维护超轻松

标签:pymysql   and   mys   evo   host   数据   pre   pytho   local   

原文地址:https://www.cnblogs.com/yiven/p/9726214.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!