I am trying to detect keystroke on my Raspberry Pi 4. To do that I am running the code as,
sudo python3 example.py
But I get error, "No module named Pandas" (The code uses Pandas). But When I am running the code using Thonny, I get no error. And also I have pandas installed (confirmed using "pip list"). So, apparently If I run the code as root I get "no modules named pandas". If I run the code as,
python3 example.py
then no problem with pandas, but python keyboard module throws an error because of root access required. I have checked,
which python
>>>/usr/bin/python
sudo which python
>>>/usr/bin/python
Then I compared between
pip3 list
sudo pip3 list
Surprisingly I found that pip3 list gives me pandas(1.4.1). But no pandas were found in sudo pip3 list!!! Now what i did was,
sudo pip3 install pandas
Now the error has changed to, "numpy.ndarray size changed, may indicate binary incompatibility. Expected 48 from C header, got 40 from PyObject". But occurring only when running code as sudo.