1

I have MySQL and Python on my computer. I want to write statements in Python scripts that extract (SELECT) data from a MySQL schema and other statements that INSERT data into MySQL tables.

My version of Python is 2.7, and I installed it via Anaconda.

From what I have read it would be appropriate to use the module “import MySQLdb”. But before doing so, I would need to download and install some code that supports this module. The only code that I have found that might work are mysql-connector-python-2.1.5-py2.7-winx64.msi or mysql-connector-python-2.1.5-py2.7-win32.msi.

When I execute either of those MSI’s, the result is a pop-up with an error message: “Python 2.7 not found. We only support Python installed using the Microsoft Windows Installer (MSI) downloaded from http://www.python.org/download/. Please check the Connector/Python manual on http://dev.mysql.com/doc/ for more information."

I skimmed the Connector/Python manual to find more information about the incompatibility; no luck. I checked the PATH on my computer; it does include c:\users\sncole\Anaconda, and python.exe does reside in this folder. Is there any way that I can use one of the MSI’s mentioned above, or is there another download that I can use for Python that was installed via Anaconda?

1
  • Did you try my answer? Commented Jan 9, 2017 at 12:36

1 Answer 1

1

Assuming that you have installed Anaconda correctly, conda should be in your path. Then you can install mysql connector by typing

conda install -c anaconda mysql-connector-python
Sign up to request clarification or add additional context in comments.

1 Comment

This worked for me. conda.exe did reside in a folder in PATH. Instead of importing MySQLdb, I used 'import mysql.connector'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.