0

I have done huge research and I still cant find way to install the mysql connector for my mac. I tried many solutions from stackoverflow that I found and still can't do it.

/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory

It gives me this error when I try to install sudo python setup.py install

I also tried homebrew and cant find any way but after I installed the connector through the website, it said that the installation was successful.

import mysql.connector
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import mysql.connector
ImportError: No module named 'mysql'  

I also get the error above.

3
  • Try to use homebrew, virtualenv and pip instead of executing setup.py mannually Commented Aug 31, 2015 at 16:30
  • stackoverflow.com/a/27749535/5032369 thank u for your help... this answer solved my issue....Thank you so muchh i have researching for more than 12 hours Commented Sep 1, 2015 at 3:08
  • getting this error while running my code on Terminal >> ModuleNotFoundError: No module named 'mysql' I've upgraded Python to 3.9.1 version, pip to 20.3.4, it says mysql.connector successfully installed yet I am not able to import it. Commented Jun 12, 2022 at 12:29

1 Answer 1

1

I am using macOS High Sierra bit confusing because two python version is available python2 is already installed, python3 i have installed through brew.

python --version

Python 2.7.10

python3 --version

Python 3.7.0

which python

/usr/bin/python

which python3

/Library/Frameworks/Python.framework/Versions/3.7/bin/python3

install mysql-connector

pip install mysql-connector-python
pip3 install mysql-connector-python

*if you getting any error like bellow *

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/_mysql_connector.so' Consider using the --user option or check the permissions.

Try this

pip install mysql-connector-python --user
pip3 install mysql-connector-python --user
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.