Debian Buster: ModuleNotFoundError: No module named 'mysql'

rackflot at gmail.com rackflot at gmail.com
Thu May 7 15:22:53 EDT 2020


On Thursday, May 7, 2020 at 7:57:14 AM UTC-4, MRAB wrote:
> 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.

This only happens when on the command line trying to run the python script. it works fine in visual studio code. 

Resinstalled all of the packages mentioned above, it keeps saying it is all fine. 

What is different in MS debugger?


More information about the Python-list mailing list