Python 3.6.4 Download Mac Updated
Python 3.6.4 Download Mac
MacOS comes with Python pre-installed. But it's Python Version 2.seven, which is now deprecated (abandoned by the Python developer community).
The entire Python customs has now moved on to using Python iii.x (the current version equally of writing this is three.9). And Python 4.10 will be out soon, but it volition be completely backward compatible.
If you try to run Python from your MacOS terminal, you'll fifty-fifty come across this warning:
Until Apple tree decides to set Python 3.x, as the default you're going to accept to install it yourself.
A Single Control to Run Python 3
For some of you reading this, this control may be enough. Y'all can run Python 3 using this command (with the 3 at the stop).
python3 If that'southward all y'all came for, no worries. Have a fun mean solar day and happy coding.
But if yous want a proper Python version control system to keep track of various versions – and take fine-grain control over which version you utilise – this tutorial will show you exactly how to attain this.
How to Install Homebrew on Mac
First you demand to install Homebrew, a powerful parcel director for Mac.
Open your terminal. Yous can do this by using MacOS spotlight (command+space) and typing "terminal".
Now that you're in a control line, you lot can install the latest version of Homebrew past running this command:
/bin/fustigate -c "$(ringlet -fsSL https://raw.githubusercontent.com/Homebrew/install/Caput/install.sh)" Your concluding will inquire for Super User-level access. Y'all will need to type your password to run this command. This is the same password you type when you log into your Mac. Type information technology and hit enter.
Homebrew volition ask you lot to confirm yous want to install the following. You accept to printing enter to continue. (Or printing any other key if you lot get cold feet.)
How to Install pyenv to Manage Your Python Versions
Now let'southward take a moment to install PyEnv. This library will help you switch between different versions of Python (in case you lot demand to run Python 2.10 for some reason, and in anticipation of Python iv.0 coming).
Run this command:
brew install pyenv
Now you tin can install the latest version of Python.
How to Use pyenv to Install Python or Update Your Python Version
Now you merely need to run the following control:
pyenv install iii.9.2 Notation that y'all can substitute 3.ix.two for any the latest version of Python is. For instance, once Python iv.0.0 comes out, you can run this:
pyenv install 4.0.0 Troubleshooting pyenv Installation
If y'all encounter an error that "C compiler cannot create executables" then the simplest way to solve this is to reinstall Apple'due south Xcode.
Xcode is a tool created by Apple tree that includes all the C libraries and other tools that Python uses when information technology runs on MacOS. Xcode is a whopping 11 gigabytes, but you'll want to be up-to-date. You may want to run this while you're sleeping.
You lot tin can become the latest version of Apple's Xcode here. I had to practise this after upgrading to MacOS Big Sur, but one time I did, all the following commands worked fine. Just re-run the above pyenv install 3.9.2 and it should now work.
How to Set up Your MacOS PATH for pyenv (Fustigate or ZSH)
First you need to update your Unix path to pave a way for PyEnv to be able to collaborate with your organisation.
This is a long caption of how PATH works in MacOS (and Unix), straight from the pyenv GitHub repo.
When you run a command likepythonorpip, your operating organisation searches through a list of directories to find an executable file with that name. This listing of directories lives in an surround variable calledPATH, with each directory in the list separated by a colon:
/usr/local/bin:/usr/bin:/bin Directories inPATHare searched from left to right, so a matching executable in a directory at the showtime of the list takes precedence over another one at the end. In this example, the/usr/local/bindirectory will exist searched outset, then/usr/bin, then/bin.
And hither is their caption of what a Shim is. I'm quoting them at length again because I actually tin can't explain this better myself.
pyenv works past inserting a directory of shims at the front of your PATH: $(pyenv root)/shims:/usr/local/bin:/usr/bin:/bin Through a procedure called rehashing, pyenv maintains shims in that directory to lucifer every Python command beyond every installed version of Python—python,pip, and so on.
Shims are lightweight executables that only pass your command forth to pyenv.
Hither'southward how to update your .bash_profile in Bash (which is installed in MacOS by default):
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile Or if y'all've installed ZSH (or OhMyZSH) like I have, you lot'll want to edit the .zshrc file instead:
echo 'export PYENV_ROOT="$Dwelling house/.pyenv"' >> ~/.zshrc echo 'consign PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc Then you want to add PyEnv Init to your terminal. Run this command if you're using Bash (again, this is the default with MacOS):
echo -e 'if control -5 pyenv 1>/dev/cipher 2>&i; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile Or run this command if y'all're using ZSH:
echo -eastward 'if control -5 pyenv ane>/dev/nix ii>&1; then\n eval "$(pyenv init --path)"\north eval "$(pyenv init -)"\nfi' >> ~/.zshrc Now reset your last by running this command:
reset How to Fix a Version of Python to Global Default (Bash or ZSH)
You can set the latest version of Python to be global, meaning it will be the default version of Python MacOS uses when you run Python applications.
Run this command:
pyenv global three.ix.2 Again, you can supercede 3.9.2 with whatever the latest version is.
Now you can verify that this worked past checking the global version of Python:
pyenv versions You should encounter this output:
The Terminal Step: Close Your Final and Restart it
Once y'all've restarted your final, yous run the python command and yous'll launch the new version of Python instead of the old ane.
Congratulations. Thank y'all for reading this, and happy coding.
Learn to code for gratis. freeCodeCamp's open source curriculum has helped more than forty,000 people get jobs as developers. Become started
Python 3.6.4 Download Mac
Posted by: evansrangho1971.blogspot.com
Post a Comment for "Python 3.6.4 Download Mac Updated"