PHP+Python,轻量维护超轻松

2021-06-16 13:04

阅读:468

标签: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


评论


亲,登录后才可以留言!