'python ImportError: No module named site
I am very new to coding, I couldn't get pycharm to work (i kept getting an error saying "failed to create virtual environment") so i used this link
https://www.ianmaddaus.com/post/manage-multiple-versions-python-mac/
to uninstall all pythons except 2.7 in the bash profile (2 of them stayed) edit: this is what i did to delete all the versions of python except 2.7: i opened the bash profile, deleted all the versions of python - i did not delete version 2.7, even though there were 2 of the same version in the bash profile, because i heard mac needs python 2.7 to function and i didn't want to mess with that. then i typed in the terminal the following code:
sudo rm -rf '/Applications/Python 3.10'
sudo rm -rf /Library/Frameworks/Python.framework
sudo rm -rf /usr/local/bin/python
sudo rm -rf /usr/local/bin/python3
now when i try to run python from the terminal i get this error:
ImportError: No module named site
and when i try to run python3 from the terminal i get this error:
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x0000000104dcce00 (most recent call first):
<no Python frame>
when i try doing this:
unset PYTHONPATH
unset PYTHONHOME
they both work (both python and python3) but they start giving the errors above again when i try later
what did i do wrong?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
