I want to connect to MySQL with Python3.Error message
At the import stage of the very first line
ImportError: No module named'MySQLdb'has occurred.
It is done after completing pip install as above site
Applicable source code
Traceback (most recent call last): File "test_MySQL3.py", line, in<module> import MySQLdb ImportError: No module named 'MySQLdb'
import MySQLdb conn = MySQL.connect (host = 'localhost', db = 'test2', user = 'hoge', passwd = 'pass', charset = 'utf8') cursor = conn.cursor ()
1.pip list I checked mysqlclient (1.3.13).
2. I tried sudo apt-get –-purge autoremove mysqlclient,
Loading package list ... Done
Creating dependency tree
Reading status information ... Done
E: Package mysqlclient could not be found. I think there is a problem around here.
Raspberry Pi 2 model B
Answer # 1
A reliable solution.
$python3 -m pip install mysqlclient
Please write your interpreter command in python3. It may be python or python3.5. You need to write the command that the questioner uses to run the program.
The path of the command such as pip3 probably passes, so if you can find the command that has the substance in the same place as the interpreter you are using (use the which command etc.), then use that Is good.
pip is actually a python module.
Because it is completely independent of system package management, it doesn't relate to apt, nor does it manage multiple python environments. It is associated with the environment of the specific python interpreter itself.
It is a simple system once you know it, but it seems to be a little difficult until you get used to it.
- python 3x - python3 whether to lose connection with mysql
- python 3x - about python3 subprocesspopen ()
- python 3x - python3 unable to get mysql table
- python 3x - what is the level of python3 logging?
- python 3x - extract specific values from python3 byte characters
- about image reading in python
- python - about importing intertools
- python - questions about how to aggregate using pandas
- python - about numpy genfromtxt
- python - about errors in skorch
- mysql - connection pool setting error
- python - about the error that occurred when creating the table
- python - about instantiation of exceptions
- python 3x - i want to rewrite the contents of json data according to the python3 argument
- python 3x - python3 tkinter scrollbar
- python - about sytemctl using error snap in slurm
- python - about getting all dataframes
- about python animation axis setting
- python 3x - python3 tkinter i want to determine if it is 5 single-byte numbers
- about python errors
- python 3x - i want to output the python3 ping result to csv
- please tell me about the range specification of image processing using opencv
- i want to put opencv in raspberry pi
- python 3x - i want to put pyqt5 in raspberry pi
- python 3x - please tell me about the error statement of pyqt5
- python 3x - i want to play music from raspberry pi
- python 3x - i want to make sound with rapberry pi
- python 3x - construction of jupyter notebook environment on raspberry pi4
- python 3x - help me! i want to put pyqt5 in my raspberry pi!
- i want to take a photo with a raspberry pi (using opencv)