How to Fix MacOS Python Installation Errors

Introduction

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"  
xcode-select --install  

How to Fix the “command not found: python” Error

python  
zsh: command not found: python  
Fix MacOS Python Installation
python3 --version  
brew install python  

3. Add Python to PATH

which python3  
echo 'export PATH="/usr/local/bin/python3:$PATH"' >> ~/.bash_profile  
source ~/.bash_profile  
python3 --version  
python3 --version  
brew upgrade python  
python3 --version
brew upgrade python  
 
python3 --version  
Python 3.12.4  
python3 --version  
Python 3.9.6  
brew install python  
brew install python  
brew list | grep python  
python@3.12
python3 -m venv myenv
source myenv/bin/activate  <br> 
deactivate 
python3 -m ensurepip --upgrade  
pip --version
python3 -m ensurepip --upgrade 
pip --version 
pip install <package>  
error: externally-managed-environment  

Using Pyenv for Version Management:

brew install pyenv
pyenv install 3.12.0
pyenv global 3.12.0
pip install pipenv
pipenv install <package> 
pipenv shell   

You May Also Like :-

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *

×