Hello readers, Today In this article I am going to show you how to solve – ‘zsh: command not found’ error in python.
Without wasting your time, Let’s start This Article to Solve This Error.
How zsh: command not found: python Error Occurs?
When your system cannot find the desired file. In the case of a conda environment, the system raises the zsh found conda command, which means that the system cannot load the conda file, and hence the error is raised.
zsh: command not found: python
So here I am writing all possible solutions that I have tried to resolve this error.
How To Solve zsh: command not found: python Error?
How To Solve zsh: command not found: python Error?
To Solve zsh: command not found: python Error First Of all, Just find Python Installation Path in your system. Open the Terminal. In your text editor, open the ~/.bash_profile file. For example – atom ~/.bash_profile; To this file, add the following line at the bottom: export PYTHONPATH=”/Users/my_user/code” Save this text editor file. Close the terminal. Restart the terminal. You can now read the new settings. Type: echo $PYTHONPATH Hope Now, Your error must be solved.
Solution 1: Set Python PATH
- First Of all, Just find Python Installation Path.
- Open the Terminal.
- In your text editor, open the ~/.bash_profile file. For example: atom ~/.bash_profile;
- To this file, add the following line at the bottom:
- export PYTHONPATH=”/Users/my_user/code”
- Save this text editor file.
- Close the terminal.
- Restart the terminal. You can now read the new settings.
- Type: echo $PYTHONPATH
- Hope Now, Your error must be solved.
Solution 2: Run this Command
First of all, Just Open Your terminal and Run This Command.
echo "alias python=/usr/bin/python3" >> ~/.zshrc
Please note that You have to Must add the Python version at the end of this line python=/usr/bin/python3 if you are using python 3 then you need to Use python3 now, your error should be fixed.
Solution 3: Export profile
First Of All Open Your terminal and Edit bash_profile with this command.
sudo nano ~/.bash_profile
It will ask Your Password Just Enter your password and paste the following lines
PYTHONPATH="<Your Python Path>"
export PYTHONPATH
Now, Your error must be solved.
Summary
It’s all About this error. Hope We solved Your error. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?