Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing MySQL Python on Mac OS X

Long story short, when I write the following:

sudo easy_install MySQL-python 

I get the error

EnvironmentError: mysql_config not found

All right, so there are plenty of threads and the like on how to fix that, so I run this code:

export PATH=$PATH:/usr/local/mysql/bin 

Then I rerun my sudo code:

sudo easy_install MySQL-python 

Then I get the following error.

Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1

Google/Stack Overflow that, and I am told to download a GCC package which I did the other day, 200 MB's or there-abouts and still no fix.

At this point I am lost, they say insanity is doing the same thing over and over while expecting a different result. Well, I've continually run the aforementioned code expecting a different result, so I'm not to far away from going insane.

At this point in my Python career, I am new to this, but I am willing to try pretty much anything to get this up and running.

If it helps I am officially running, Mac OS X 10.7.5, and I do have MAMP installed (is that an issue?)

Also, the other day when I was trying all of this for the first time I installed (reinstalled?) MySQL, so I'm really in a tough spot at this point.

Is there a fix?

I've racked my brain, searched Google, read Stack Overflow, and spent hours trying to figure this out to no avail.

like image 616
Peter Foti Avatar asked Apr 24 '13 02:04

Peter Foti


People also ask

Can I install MySQL on Mac?

MySQL for macOS is available in a number of different forms: Native Package Installer, which uses the native macOS installer (DMG) to walk you through the installation of MySQL. For more information, see Chapter 2, Installing MySQL on macOS Using Native Packages. You can use the package installer with macOS.

How do I install MySQL on Python 3?

The easiest way to probably install and use MySQL in Python is to open up your command prompt. Once the command prompt is opened, then specify the full path to the Scripts folder of the Python package. Once you have this full path specified to the Scripts folder, then type in, pip install pymysql.


1 Answers

Here's what I would install, especially if you want to use homebrew:

  • XCode and the command line tools (as suggested by @7stud, @kjti)
  • Install homebrew
  • brew install mysql-connector-c
  • pip install mysql-python
like image 191
m01 Avatar answered Oct 06 '22 01:10

m01