0

I've been struggling outstandingly lot with the installation of MySQL for Python recently. I've read all forum comments that I could find, either here or other related forums, but none of the recommendations seemed to help. Below are some details.

When I try to start the installation of MySQL connector the following error message pops up immediately: "Python v3.4 not found. We only support Python installed uing 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 info."

My operating system: Windows 7, 64-bit version Python is correctly installed from here, version: 3.4.0, Windows x86-64 MSI installer

MySQL Connector is from here

I've set my environmental variables (My Computer > Properties > Advanced System Settings > Environment Variables), first I tried to add C:\Python34\ to path, later I created a new environmental variable with the name 'PythonPath' and loaded C:\Python34 and all its subfolders in it.

I uninstalled and reinstalled both the Python version and MySQL, it didn't help. I don't have any other older version of Python installed. Later I reinstalled Python again because I read in one of the posts that installing the software for all users of the computer might help. Neither this helped me.

I tried the installation via the command prompt, it didn't help either.

Someone recommended me to uninstall Python 64-bit version and install the 32-bit version instead but I'm bound to version 3.4.0 and apparently 32-bit edition doesn't exist for this version.

If you had any advice I would be really grateful because I'm getting awfully desperate with all this.


Edit: When I tried it with pip in command line with this statement: pip install MySQL-python, I got the following error message: Could not find a version that satisfies the requirement MySQL-python==2.1.7 (from versions: 1;2;4b5 ... 1.2.4b4] ) Then I tried to install the latest version offered by the error message and I arrived at a new error: Command python setup.py egg_info failed with error code 1 in C:\Users...

Edit no2: Again command window: pip install mysql-python has led to: Command C:\Python34...mysql-python\setup.py ... compile failed with error code 1.

Edit no3: I forgot to mention above that the original problem occurred when I wanted to run my program (working with databases) in the command window. It didn't run, instead gave the error of ImportError: No module names 'mysql'. Thus, I started to look for ways of installing the missing module.

lazarea
  • 1,129
  • 14
  • 43

2 Answers2

0

Could you clarify what you are trying to do? MySQL Connector looks like a database driver...do you want a client library instead?

There are many such libraries, but pymysql is one I have found to be useful.

speedyturkey
  • 126
  • 9
  • I want to work with databases through a Python program. That's why I need somehow to connect to MySQL databases, to be able to run the programs. When I run the program in commend line, I get the No module named 'mysql', That's the reason I started to look after how to install the missing module. – lazarea Sep 26 '17 at 16:24
  • See https://stackoverflow.com/questions/372885/how-do-i-connect-to-a-mysql-database-in-python – speedyturkey Sep 26 '17 at 16:34
  • Thank zou, but unfortunately I've seen already this post, and MySQLdb is not supported by Python 3+ apparently: https://stackoverflow.com/questions/23376103/python-3-4-0-with-mysql-database – lazarea Sep 26 '17 at 16:53
0

I could finally do it! In case someone else goes through the same nightmare as I had, here is the solution: instead of using command line I opened up Windows Power Shell and typed

pip install mysql-python

And it succeeded in downloading and Python script doesn't throw error anymore.

lazarea
  • 1,129
  • 14
  • 43