You cannot and you should not mess with the system python
Don’t ever do pacman -Rns python it will have catastropic results for your system
Your error is likely cause by your attempt to uninstall python.
$ cat test.py
print('test')
$ python test.py
test
Use virtual environment(s) as your sandbox