Answer the question
In order to leave comments, you need to log in
PyCharm: how to load mysql.connector module?
Hello! You need to connect to a MySQL database.
In PyCharm, when I try to execute import mysql.connector, I get:
File "/home/user/PycharmProjects/dartshire/venv/main.py", line 6, in
import mysql
ImportError: No module named 'mysql'
$ python
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mysql.connector
>>>
Answer the question
In order to leave comments, you need to log in
Since main.py is run inside venv (I guess), mysql might not be there. You need to install it inside venv:
>>> source venv/bin/activate
>>> pip install mysql
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question