Debian Buster: ModuleNotFoundError: No module named 'mysql'
MRAB
python at mrabarnett.plus.com
Thu May 7 07:53:18 EDT 2020
On 2020-05-07 12:30, rackflot at gmail.com wrote:
> I have the same issue. I use visual code from Ms and the remote debugging over an ssh.
> I am able to do all mysql while in the debugger but running on command line does not work.
> The DB is logged in as root as this was the only way I could make it work.
>
> pi at raspberrypi:~/blescan/iBeacon-Scanner-$ pip search mysql-connector | grep --color mysql-connector-python
> mysql-connector-python (8.0.20) - MySQL driver written in Python
> mysql-connector-python-dd (2.0.2) - MySQL driver written in Python
> mysql-connector-python-rf (2.2.2) - MySQL driver written in Python
> pi at raspberrypi:~/blescan/iBeacon-Scanner-$ pip install mysql-connector-python-rf
> Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
> Requirement already satisfied: mysql-connector-python-rf in /home/pi/.local/lib/python3.7/site-packages (2.2.2)
> pi at raspberrypi:~/blescan/iBeacon-Scanner-$ sudo python3 BeaconClass.py
> Traceback (most recent call last): File "BeaconClass.py", line 7, in <module>
> import mysql.connector as mariadb ModuleNotFoundError: No module named 'mysql'
> pi at raspberrypi:~/blescan/iBeacon-Scanner-$
>
I believe that it's "pip" for "python" (Python 2) and "pip3" for
"python3" (Python 3).
Personally, I'd use:
python3 -m pip ...
or:
sudo python3 -m pip ...
instead.
More information about the Python-list
mailing list