收入两个安装关于安装MySQLdb的URL
http://stackoverflow.com/questions/645943/mysql-for-python-in-windows
As Python newbie learning the Python ecosystem I've just completed this.
Install setuptools instructions
Install MySQL 5.1. Download the 97.6MB MSI from here You can't use the essentials version because it doesnt contain the C libraries.
Be sure to select a custom install, and mark the development tools / libraries for installation as that is not done by default. This is needed to get the C header files.
You can verify you have done this correctly by looking in your install directory for a folder named "include". E.G C:\Program Files\MySQL\MySQL Server 5.1\include. It should have a whole bunch of .h files.
Install Microsoft Visual Studio C++ Express 2008 from here This is needed to get a C compiler.
Open up a command line as administrator (right click on the Cmd shortcut and then "run as administrator". Be sure to open a fresh window after you have installed those things or your path won't be updated and the install will still fail.
From the command prompt:
easy_install -b C:\temp\sometempdir mysql-python
That will fail - which is OK.
Now open site.cfg in your temp directory C:\temp\sometempdir and edit the "registry_key" setting to:
registry_key = SOFTWARE\MySQL AB\MySQL Server 5.1
now CD into your temp dir and:
python setup.py clean
python setup.py install
You should be ready to rock!
Here is a super simple script to start off learning the Python DB API for you - if you need it.
http://hi.baidu.com/koflance/blog/item/78ae37f90f66c615a9d311f3.html
Now try to build it again. I got this :
error: build\temp.win32-2.6\Release\_mysql.pyd.manifest : general error c1010070: Failed to load and parse the manifest.
The system cannot find the file specified. error: command ‘mt.exe’ failed with exit status 31 To fix this problem, go to C:\Python26\Lib\distutils, edit msvc9compiler.py, search for ‘MANIFESTFILE’, you will find the following line ld_args.append(’/MANIFESTFILE:’ + temp_manifest) Then append the following line after the above line, ld_args.append(’/MANIFEST’) Then go back to run “setup.py build”, it will succeed.
Finally, run setup.py install Test it in python >>> import MySQLdb >>>
分享到:
相关推荐
python MySQL-python模块 django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb. Did you install mysqlclient or MySQL-python?
On Windows, there are binary wheel you can install without MySQLConnector/C or MSVC. #### Note on Python 3 : if you are using python3 then you need to install python3-dev using the following command...
2)下载附件中的文件,放至/usr/include目录下,重新执行python seup.py install MySQL-python-1.2.5.zip 下载链接:https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068
mysql-community-client depends on libaio1 (>= 0.3.93); however: Package libaio1 is not installed. dpkg: error processing package mysql-community-client (--install): dependency problems - leaving ...
安装MySQL服务器可使用`yum install`命令,例如`yum install mysql-community-server`。安装完成后,启动MySQL服务,CentOS7中使用`systemctl start mysqld.service`。如果在较低版本的系统中,可以使用`service ...
### Python3连接MySQL知识点概述 在使用Python进行Web开发、数据分析以及其他涉及数据库操作的应用场景时,连接并操作MySQL数据库是一项非常基础且重要的技能。本文将详细介绍如何使用Python3连接MySQL数据库,并...
9. **配置开机启动**:`sudo systemctl enable mysqld`或`sudo chkconfig mysqld on`,确保系统启动时自动启动MySQL。 在MySQL 5.6.35版本中,关键的改进和特性包括: - **性能提升**:引入了InnoDB存储引擎的并行...
安装MySQL-5.1.56 on Linux通常涉及以下步骤: 1. 下载:您已经拥有名为“mysql-5.1.56.tar_PiaoXu.net.gz”的压缩文件,这是Linux上的标准tarball格式,包含所有必要的源代码。首先,使用`gunzip`解压gz文件,然后...
#OperatorCenter ========= #Config #Flask-WTF https://flask-wtf.readthedocs.org/en/latest/install.html #Flask-WTF $ easy_install Flask-WTF ...http://yuji.wordpress.com/2009/08/31/python-on-window
《PyPI官网下载的mysql-connector-repackaged-0.3.1.tar.gz:Python连接MySQL数据库的关键工具》 在Python编程中,与各种数据库进行交互是常见的需求,特别是对于MySQL这种广泛使用的开源关系型数据库管理系统。...
install-node-msi-version-on-windows-step1 步骤 2 : 点击以上的Run(运行),将出现如下界面: install-node-msi-version-on-windows-step2 步骤 3 : 勾选接受协议选项,点击 next(下一步) 按钮 : install-...
mysql> GRANT ALL PRIVILEGES ON demo_django_supermarket.* TO 'admin'@'localhost'; ``` ### 初始化数据 1. migrate 迁移/初始化数据库 ```bash > python3 manage.py makemigrations > python3 manage.py ...
pip install mysql-connector-python ``` #### 三、示例代码详解 接下来,我们将逐步分析提供的示例代码。 ##### 1. 导入必要的库 ```python import mysql.connector ``` 这里导入了`mysql.connector`模块,它是...
pip install mysql-connector-python ``` 该命令会自动下载并安装所需的库及其依赖项。 ##### 2. 数据库配置信息 连接数据库之前,需要准备一个包含数据库连接信息的字典。这些信息通常包括用户名、密码、主机...
《PyPI官网下载:pandas_upsert_to_mysql-0.0.3.tar.gz——Python数据库操作新星》 在Python的生态环境中,PyPI(Python Package Index)是开发者们获取和分享开源软件的重要平台。本资源,"pandas_upsert_to_mysql...
pip install mysql-connector-python ``` 然后,你可以编写以下代码来连接 MySQL 数据库: ```python import mysql.connector # 创建数据库连接 cnx = mysql.connector.connect(user='your_username', password='...
pip install mysql-connector-python ``` 编写Python脚本连接数据库: ```python import mysql.connector cnx = mysql.connector.connect(user='newuser', password='password', host='localhost', database='...
搭建Apache+Python+Django+MySQL Web开发环境 本文将详细介绍如何搭建Apache+Python+Django+MySQL Web开发环境,并对相关的技术进行详细的解释。 一、 Python 语言简介 Python是一种面向对象、直译式计算机程序...
要解决这个问题,你需要使用Python的包管理器pip来安装`mysql-connector-python`模块,命令是`pip install mysql-connector-python`。确保你的Python环境已经配置好,并且具备网络连接,这样就能成功安装缺失的模块...
- 安装 MySQL:`yum install -y mysql-server mysql mysql-devel` - 启动 MySQL 服务:`/etc/init.d/mysqld start` - 检查 MySQL 是否设置为开机启动:`chkconfig --list | grep mysqld` - 如果没有,设置为开机...