I am currently needing to create a python script that access my MariaDB database on my local machine.
My file named Murphy.py contains
# file: Murphy.py
import mariadb
In the same directory as my Murphy.py I run the command to update my python to python 3
$ brew install python3
Then to install mariadb module for python i run
$ pip3 install mariadb
It returns the message
Collecting mariadb
Downloading mariadb-1.0.6.tar.gz (67 kB)
|████████████████████████████████| 67 kB 6.4 MB/s
Building wheels for collected packages: mariadb
Building wheel for mariadb (setup.py) ... done
Created wheel for mariadb: filename=mariadb-1.0.6-cp39-cp39-macosx_11_0_x86_64.whl size=59180 sha256=17d128175eab51d0edc8387999d5eb7100f80787f95f595561a061c540f364fd
Stored in directory: /Users/owenmurphy/Library/Caches/pip/wheels/d7/4a/4f/05b62af6cd28564b274014392f29113b6fedfeaaaaab21441a
Successfully built mariadb
Installing collected packages: mariadb
Successfully installed mariadb-1.0.6
Then I try and run the file using the command
$ python Murphy.py
Which returns the error
Traceback (most recent call last):
File "Murphy.py", line 4, in <module>
import mariadb
ImportError: No module named mariadb
I am not sure what I am doing wrong. Any help is great!
NOTE: I am running macOS Bug Sur Version 11.2.1
Let me know if more info is needed!
python --version?Python 2.7.16