0

So I'm trying to follow a tutorial to connect to an SQL database, using Connector/Python.

I have to import it, obviously:

import mysql.connector

So I tried pip install mysql in the terminal.

This is what I got:

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/g6/yrxcmygn3ls375rm9rh3p86r0000gn/T/pip-build-a0d0rzdl/MySQL-python/

What I've tried from looking up on Google:

pip install --upgrade setuptools

pip install ez_setup

pip install unroll

easy_install -U setuptools

Nothing worked

Thanks

Michael
  • 503
  • 8
  • 18
  • See http://stackoverflow.com/questions/40512331/how-to-install-mysql-python-by-pip then maybe see http://stackoverflow.com/questions/26560973/python3-mysql-error-loading-mysqldb-module-no-module-named-mysqldb/40557340#40557340 – Dan-Dev May 20 '17 at 19:12
  • Which OS do you use? Linux, Windows, ...? Which version? – Laurent LAPORTE May 20 '17 at 19:38

1 Answers1

1

MySQL-Python is not available for Python 3, you may consider using MySqlClient which is a fork of the MySQL-python interface for the MySQL database.

Before installing this connector, make sure MySQL (or MariaDB) is installed.

To install, an application, the best practices is to use a virtualenv.

Graham
  • 7,431
  • 18
  • 59
  • 84
Laurent LAPORTE
  • 21,958
  • 6
  • 58
  • 103