PHP+Python,轻量维护超轻松
2023-02-18 16:29:48 时间
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
本文采用 「CC BY-NC-SA 4.0」创作共享协议,转载请标注以下信息: 原文出处:Yiiven https://www.yiiven.cn/php-python-lightweight-maintenance.html