I'm trying to import a MySQL module with python, more specifically Flask, though I receive an error. I'm using a virtual environment with my application. Here is the error:
    Traceback (most recent call last):
  File "../myapp/application.py", line 9, in <module>
    from flask.ext.mysql import MySQL
  File "/Users/pavsidhu/Documents/Web-Development/app/env/lib/python2.7/site-packages/flask/exthook.py", line 81, in load_module
    reraise(exc_type, exc_value, tb.tb_next)
  File "/Users/pavsidhu/Documents/Web-Development/app/env/lib/python2.7/site-packages/flaskext/mysql.py", line 3, in <module>
    import MySQLdb
  File "/Users/pavsidhu/Documents/Web-Development/app/env/lib/python2.7/site-packages/MySQLdb/__init__.py", line 19, in <module>
    import _mysql
ImportError: dlopen(/Users/pavsidhu/Documents/Web-Development/app/env/lib/python2.7/site-packages/_mysql.so, 2): Library not loaded: /Library/Python/2.7/site-packages/_mysql.so
  Referenced from: /Users/pavsidhu/Documents/Web-Development/app/env/lib/python2.7/site-packages/_mysql.so
  Reason: image not found
I can see in the error it says Library not loaded: /Library/Python/2.7/site-packages/_mysql.so. As I'm using a virtual environment that path is incorrect. It should be /lib/python2.7/site-packages/_mysql.so.
Is there a way to change this? Thanks.
EDIT:
I found there was a terminal command on OSX to change the library location:
 sudo install_name_tool -change libmysqlclient.18.dylib /lib/python2.7/site-packages/MySQLdb/
though after hitting enter I get this:
Usage: /Library/Developer/CommandLineTools/usr/bin/install_name_tool [-change old new] ... [-rpath old new] ... [-add_rpath new] ... [-delete_rpath old] ... [-id name] input
I don't appear to be entering the command wrong, what is the issue?
 
    