How to Download Python 3.6.2 Tutorial on Mac
Sentinel At present This tutorial has a related video form created by the Real Python team. Watch it together with the written tutorial to deepen your understanding: Python Basics: Setting Up Python
Installing or updating Python on your computer is the first step to becoming a Python developer. There are a multitude of installation methods: you lot can download official Python distributions from Python.org, install from a bundle director, and even install specialized distributions for scientific computing, Cyberspace of Things, and embedded systems.
This tutorial focuses on official distributions, as they're generally the all-time option for getting started with learning to programme in Python.
In this tutorial you'll learn how to:
- Check which version of Python, if whatever, is installed on your automobile
- Install or update Python on Windows, macOS, and Linux
- Use Python on mobile devices like phones or tablets
- Use Python on the Web with online interpreters
No matter what operating system you're on, this tutorial has you covered. Detect your operating system below and swoop in!
How to Install Python on Windows
There are three installation methods on Windows:
- The Microsoft Store
- The full installer
- Windows Subsystem for Linux
In this section, you'll larn how to cheque which version of Python, if whatsoever, is installed on your Windows reckoner. Yous'll too learn which of the three installation methods you should use.
How to Check Your Python Version on Windows
To check if you already have Python on your Windows motorcar, get-go open up a command-line application, such as PowerShell.
You can as well use cmd.exe
or Windows Final.
With the command line open, type in the following control and press Enter :
C:\> python --version Python iii.8.iv
Using the --version
switch volition show you the version that's installed. Alternatively, yous can employ the -V
switch:
C:\> python -Five Python 3.viii.4
In either case, if y'all see a version less than 3.8.4
, which was the about recent version at the time of writing, and so you'll desire to upgrade your installation.
If you're interested in where the installation is located, then yous tin use the where.exe
control in cmd.exe
or PowerShell:
C:\> where.exe python C:\Users\mertz\AppData\Local\Programs\Python\Python37-32\python.exe
Note that the where.exe
command will piece of work only if Python has been installed for your user account.
What Your Options Are
Equally mentioned earlier, in that location are three ways to install the official Python distribution on Windows:
-
Microsoft Shop package: The nigh straightforward installation method on Windows involves installing from the Microsoft Store app. This is recommended for beginner Python users looking for an piece of cake-to-set up-up interactive experience.
-
Total Installer: This arroyo involves downloading Python directly from the Python.org website. This is recommended for intermediate and advanced developers who demand more control during the setup procedure.
-
Windows Subsystem for Linux (WSL): The WSL allows you to run a Linux surround directly in Windows. Yous can learn how to enable the WSL by reading the Windows Subsystem for Linux Installation Guide for Windows 10.
In this section, we'll focus on simply the beginning two options, which are the most popular installation methods in a Windows environment.
If y'all want to install in the WSL, then you can read the Linux department of this tutorial subsequently yous've installed the Linux distribution of your pick.
The two official Python installers for Windows aren't identical. The Microsoft Store parcel has some important limitations.
Limitations of the Microsoft Shop Packet
The official Python documentation has this to say about the Microsoft Store package:
The Microsoft Shop package is an easily installable Python interpreter that is intended mainly for interactive use, for case, by students. (Source)
The central takeaway hither is that the Microsoft Store parcel is "intended mainly for interactive utilise." That is, the Microsoft Store bundle is designed to exist used by students and people learning to apply Python for the get-go fourth dimension.
In add-on to targeting beginning Pythonistas, the Microsoft Store parcel has limitations that make it ill-suited for a professional evolution surroundings. In item, it does not have full write admission to shared locations such as TEMP
or the registry.
Windows Installer Recommendations
If you're new to Python and focused primarily on learning the language rather than building professional software, then you should install from the Microsoft Store package. This offers the shortest and easiest path to getting started with minimal hassle.
On the other hand, if you lot're an experienced programmer looking to develop professional software in a Windows environment, and so the official Python.org installer is the correct choice. Your installation won't be limited by Microsoft Store policies, and you tin can control where the executable is installed and even add Python to PATH
if necessary.
How to Install From the Microsoft Store
If you lot're new to Python and looking to get started rapidly, and then the Microsoft Shop bundle is the best fashion to become up and running without whatsoever fuss. Y'all tin install from the Microsoft Shop in two steps.
Pace i: Open the Python App Folio in the Microsoft Store
Open the Microsoft Store app and search for Python
.
Y'all'll probable run into multiple versions that yous tin can choose to install:
Select Python three.eight, or the highest version number you meet bachelor in the app, to open up the installation folio.
Alternatively, y'all can open PowerShell and blazon the following command:
If you don't already have a version of Python on your system, then when you press Enter , the Microsoft Store volition automatically launch and take you to the latest version of Python in the store.
Step two: Install the Python App
Later you lot've selected the version to exist installed, follow these steps to consummate the installation:
-
Click Get.
-
Wait for the awarding to download. When it's finished downloading, the Get button will be replaced with a button that says Install on my devices.
-
Click Install on my devices and select the devices on which yous'd like to complete the installation.
-
Click Install Now and and then OK to start the installation.
-
If the installation was successful, then you'll encounter the message "This product is installed" at the top of the Microsoft Store page.
Congratulations! You at present accept access to Python, including pip
and IDLE!
How to Install From the Full Installer
For professional developers who need a total-featured Python evolution surround, installing from the full installer is the correct selection. It offers more customization and control over the installation than installing from the Microsoft Store.
You can install from the full installer in two steps.
Pace 1: Download the Total Installer
Follow these steps to download the full installer:
-
Open a browser window and navigate to the Python.org Downloads folio for Windows.
-
Under the "Python Releases for Windows" heading, click the link for the Latest Python three Release - Python 3.x.10. As of this writing, the latest version was Python 3.8.four.
-
Scroll to the bottom and select either Windows x86-64 executable installer for 64-bit or Windows x86 executable installer for 32-bit.
If you aren't sure whether to select the 32-bit or the 64-fleck installer, and then y'all can aggrandize the box below to assistance you decide.
For Windows, you can cull either the 32-bit or the 64-bit installer. Here's the difference betwixt the two:
-
If your system has a 32-bit processor, then you should choose the 32-bit installer. If you attempt to install the 64-bit version on a 32-flake processor, then you'll become an error at the start and the install will neglect.
-
On a 64-bit system, either installer will piece of work for most purposes. The 32-bit version will generally use less memory, merely the 64-bit version performs better for applications with intensive computation.
If yous're unsure which version to pick, go with the 64-bit version.
If y'all have a 64-bit system and would like to switch from 64-bit Python to 32-scrap (or vice versa), and so you can just uninstall Python and then reinstall it by downloading the other installer from Python.org.
When the installer is finished downloading, motility on to the next step.
Step 2: Run the Installer
Once you've chosen and downloaded an installer, run it by double-clicking on the downloaded file. A dialog box like the one below will appear:
At that place are four things to discover nigh this dialog box:
-
The default install path is in the
AppData/
directory of the current Windows user. -
The Customize installation button can be used to customize the installation location and which additional features get installed, including
pip
and IDLE. -
The Install launcher for all users (recommended) checkbox is checked default. This means every user on the machine will have access to the
py.exe
launcher. You tin can uncheck this box to restrict Python to the current Windows user. -
The Add Python three.8 to
PATH
checkbox is unchecked by default. At that place are several reasons that you might not desire Python onPATH
, so make sure you lot sympathise the implications before you check this box.
The full installer gives you total control over the installation process.
Customize the installation to run across your needs using the options bachelor on the dialog box. Then click Install Now. That'south all there is to it!
Congratulations—you now have the latest version of Python 3 on your Windows automobile!
How to Install Python on macOS
Python ii comes preinstalled on older versions of macOS. This is no longer the example for electric current versions of macOS, starting with macOS Catalina.
At that place are two installation methods on macOS:
- The official installer
- The Homebrew parcel manager
In this section, you'll learn how to check which version of Python, if any, is installed on your macOS device. You'll likewise learn which of the two installation methods you lot should use.
How to Bank check Your Python Version on a Mac
To check which Python version y'all have on your Mac, first open up a control-line awarding, such as Terminal.
With the command line open, type in the following commands:
# Check the system Python version $ python --version # Check the Python 2 version $ python2 --version # Bank check the Python three version $ python3 --version
If you have Python on your system, then one or more than of these commands should respond with a version number.
For instance, if Python 3.6.10 were already set on your estimator, so the python3
control would display that version number:
$ python3 --version Python iii.6.10
- None of the in a higher place commands returns a version number.
- The only version you encounter displayed is in the Python ii.X serial.
- You lot have a version of Python 3 that isn't the latest available, which was version three.viii.4 as of this writing.
What Your Options Are
There are 2 ways to install the official Python distribution on macOS:
-
The official installer: This method involves downloading the official installer from the Python.org website and running it on your machine.
-
The Homebrew package manager: This method involves downloading and installing the Homebrew packet director if you lot don't already have it installed, and so typing a command into a terminal awarding.
Both the official installer and the Homebrew packet manager will work, but but the official installer is maintained by the Python Software Foundation.
The distributions installed by the official installer and the Homebrew package director aren't identical. Installing from Homebrew has some limitations.
Limitations of Installing From Homebrew
The Python distribution for macOS available on Homebrew doesn't include the Tcl/Tk dependency required past the Tkinter module. Tkinter is the standard library module for developing graphical user interfaces in Python and is in fact an interface for the Tk GUI toolkit, which isn't part of Python.
Homebrew doesn't install the Tk GUI toolkit dependency. Instead, it relies on an existing version installed on your organisation. The system version of Tcl/Tk may be outdated or missing entirely and could prevent yous from importing the Tkinter module.
macOS Installer Recommendations
The Homebrew package manager is a popular method for installing Python on macOS because information technology's easy to manage from the command line and offers commands to upgrade Python without having to become to a website. Because Homebrew is a control-line utility, it can be automated with bash scripts.
However, the Python distribution offered past Homebrew isn't controlled past the Python Software Foundation and could modify at any time. The most reliable method on macOS is to utilise the official installer, specially if you plan on doing Python GUI programming with Tkinter.
How to Install From the Official Installer
Installing Python from the official installer is the nigh reliable installation method on macOS. It includes all the organisation dependencies needed for developing applications with Python.
You can install from the official installer in 2 steps.
Pace one: Download the Official Installer
Follow these steps to download the full installer:
-
Open a browser window and navigate to the Python.org Downloads page for macOS.
-
Nether the "Python Releases for Mac Bone X" heading, click the link for the Latest Python three Release - Python 3.x.x. As of this writing, the latest version was Python 3.8.4.
-
Scroll to the lesser and click macOS 64-bit installer to start the download.
When the installer is finished downloading, movement on to the next footstep.
Stride 2: Run the Installer
Run the installer by double-clicking the downloaded file. Yous should come across the following window:
Follow these steps to complete the installation:
-
Press Continue a few times until you're asked to concord to the software license agreement. So click Agree.
-
You'll be shown a window that tells you the install destination and how much infinite it will take. You most likely don't want to change the default location, and then go ahead and click Install to first the installation.
-
When the installer is finished copying files, click Close to close the installer window.
Congratulations—you now take the latest version of Python 3 on your macOS computer!
How to Install From Homebrew
For users who need to install from the command line, especially those who won't be using Python to develop graphical user interfaces with the Tkinter module, the Homebrew packet manager is a skilful pick. You can install from the Homebrew bundle manager in ii steps.
Footstep 1: Install Homebrew
If you already have Homebrew installed, and then yous tin can skip this step. If you don't accept Homebrew installed, so apply the post-obit procedure to install Homebrew:
-
Open up a browser and navigate to http://brew.sh/.
-
You should meet a command for installing Homebrew near the pinnacle of the page under the tile "Install Homebrew." This command volition be something like the following:
$ /bin/fustigate -c " $(gyre -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh) "
Highlight the command with your cursor and printing Cmd + C to copy information technology to your clipboard.
-
Open up a terminal window and paste the command, then printing Enter . This will begin the Homebrew installation.
-
Enter your macOS user password when prompted.
Depending on your Internet connection, information technology may take a few minutes to download all of Homebrew'southward required files. Once the installation is complete, you'll cease upwards back at the shell prompt in your terminal window.
Now that Homebrew is installed, you're gear up to install Python.
Footstep ii: Install Python
Follow these steps to complete the installation with Homebrew:
-
Open up a last application.
-
Type in the following command to upgrade Homebrew:
$ mash update && brew upgrade
Installing with Homebrew is now as straightforward as running the control brew install python3
. This will download and set up the latest version of Python on your machine.
Yous can make certain everything went correctly by testing if you can access Python from the terminal:
-
Open a terminal.
-
Type
pip3
and press Enter . -
You should come across the assistance text from Python's
pip
packet manager. If you get an error message runningpip3
, then go through the install steps again to brand sure you take a working installation.
Congratulations—you now have Python on your macOS system!
How to Install Python on Linux
There are 2 installation methods on Linux:
- Using your operating organization's package manager
- Edifice Python from source code
In this section, yous'll learn how to cheque which version of Python, if any, is on your Linux computer. You lot'll also learn which of the two installation methods you should use.
How to Check Your Python Version on Linux
Many Linux distributions come packaged with Python, merely it probably won't be the latest version and may even be Python 2 instead of Python 3. Yous should check the version to make sure.
To find out which version of Python you have, open a final window and try the following commands:
# Check the system Python version $ python --version # Check the Python 2 version $ python2 --version # Cheque the Python 3 version $ python3 --version
If you have Python on your machine, so one or more than of these commands should respond with a version number.
For example, if you already had Python 3.6.10 on your computer, and then the python3 --version
command would display that version number:
$ python3 --version Python 3.6.10
Yous'll want to become the latest version of Python if your current version is in the Python 2.X series or is not the latest version of Python iii available, which was 3.8.four equally of this writing.
What Your Options Are
There are two ways to install the official Python distribution on Linux:
-
Install from a package manager: This is the most common installation method on most Linux distributions. Information technology involves running a command from the control line.
-
Build from source code: This method is more difficult than using a package manager. It involves running a serial of commands from the command line equally well as making certain you take the correct dependencies installed to compile the Python source code.
Not every Linux distribution has a bundle manager, and not every parcel manager has Python in its bundle repository. Depending on your operating system, building Python from source code might be your but selection.
Which installation method you use mainly boils downwardly to whether your Linux Os has a package manager and whether y'all demand to control the details of the installation.
Linux Installation Recommendations
The nigh pop way to install Python on Linux is with your operating organisation's package manager, which is a good choice for most users. However, depending on your Linux distribution, Python may not be bachelor through a packet manager. In this instance, you'll need to build Python from source code.
There are three primary reasons that you might choose to build Python from source code:
-
You can't download Python from your operating system's package manager.
-
You need to control how Python gets compiled, such every bit when you want to lower the memory footprint on embedded systems.
-
You desire to try out beta versions and release candidates of the latest and greatest version earlier it's generally bachelor.
To consummate the installation on your Linux machine, find your Linux distribution beneath and follow the steps provided.
How to Install on Ubuntu and Linux Mint
In this section, you'll learn how to install Python using Ubuntu's apt
packet manager. If you'd like to build Python from source code, skip alee to the How to Build Python From Source Code section.
Depending on the version of the Ubuntu distribution y'all run, the process for setting upward Python on your system volition vary. You can determine your local Ubuntu version by running the following command:
$ lsb_release -a No LSB modules are available. Benefactor ID: Ubuntu Description: Ubuntu 16.04.iv LTS Release: sixteen.04 Codename: xenial
Follow the instructions below that match the version number you run into nether Release
in the console output:
-
Ubuntu xviii.04, Ubuntu 20.04 and above: Python 3.eight doesn't come past default on Ubuntu 18.04 and above, just it is bachelor in the Universe repository. To install version three.8, open a terminal application and type the following commands:
$ sudo apt-become update $ sudo apt-get install python3.8 python3-pip
In one case the installation is consummate, you can run Python three.viii with the
python3.8
command andpip
with thepip3
command. -
Linux Mint and Ubuntu 17 and below: Python 3.8 isn't in the Universe repository, so yous need to get it from a Personal Package Archive (PPA). For example, to install from the "deadsnakes" PPA, employ the following commands:
$ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt-get update $ sudo apt-get install python3.8 python3-pip
Once the installation is complete, yous can run Python 3.eight with the
python3.8
command and runpip
with thepip3
command.
Congratulations! You at present accept Python 3 prepare upwardly on your machine!
How to Install on Debian Linux
Earlier you tin can install Python three.8 on Debian, you'll need to install the sudo
control. To install it, execute the following commands in a terminal:
$ su $ apt-get install sudo $ sudo vim /etc/sudoers
Afterward that, open the /etc/sudoers
file using the sudo vim
command or your favorite text editor. Add the following line of text to the finish of the file, replacing your_username
with your bodily username:
your_username ALL=(ALL) ALL
Now yous tin can skip ahead to the How to Build Python From Source Code section to cease installing Python.
How to Install on openSUSE
Edifice from source is the almost reliable style to prepare Python on openSUSE. To do that, you'll need to install the evolution tools, which can be done in YaST
via the menus or past using zypper
:
$ sudu zypper install -t pattern devel_C_C
This might take a while to complete equally it installs over 150 packages. One time it's completed, skip ahead to the How to Build Python From Source Code section.
How to Install on CentOS and Fedora
Python 3.8 isn't available in the CentOS and Fedora repositories, so you'll have to build Python from source code. Before yous compile Python, though, you demand to make certain your arrangement is prepared.
First, update the yum
package manager:
Once yum
finishes updating, yous tin can install the necessary build dependencies with the following commands:
$ sudo yum -y groupinstall "Development Tools" $ sudo yum -y install gcc openssl-devel bzip2-devel libffi-devel
When everything is finished installing, skip alee to the How to Build Python From Source Code department.
How to Install on Arch Linux
Curvation Linux is fairly diligent most keeping up with Python releases. It's likely you already have the latest version. If not, use the post-obit command to update Python:
When Python is finished updating, yous should exist all set!
How to Build Python From Source Code
Sometimes your Linux distribution doesn't take the latest version of Python, or maybe you just want to exist able to build the latest, greatest version yourself. Here are the steps you need to take to build Python from source:
Step 1: Download the Source Code
To kickoff, y'all demand to get the Python source code. Python.org makes this fairly straightforward. If you get to the Downloads page, then y'all'll see the latest source for Python 3 at the top. Only make sure you don't grab Legacy Python, Python ii!
When you select the Python 3 version, you'll see a "Files" section at the bottom of the page. Select Gzipped source tarball and download it to your automobile. If you prefer a control-line method, you tin can use wget
to download the file to your electric current directory:
$ wget https://world wide web.python.org/ftp/python/3.8.4/Python-3.8.four.tgz
When the tarball finishes downloading, at that place are a few things yous'll need to do to fix your organisation for building Python.
Pace 2: Prepare Your Organisation
There are a few distro-specific steps involved in building Python from scratch. The goal of each step is the same on all distros, only you might need to translate to your distribution if it doesn't use apt-get
:
-
First, update your bundle managing director and upgrade your packages:
$ sudo apt-become update $ sudo apt-get upgrade
-
Next, make sure you have all of the build requirements installed:
# For apt-based systems (like Debian, Ubuntu, and Mint) $ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \ libbz2-dev libreadline-dev libsqlite3-dev wget ringlet llvm \ libncurses5-dev libncursesw5-dev xz-utils tk-dev # For yum-based systems (similar CentOS) $ sudo yum -y groupinstall "Development Tools" $ sudo yum -y install gcc openssl-devel bzip2-devel libffi-devel
It's fine if you already take some of the requirements installed on your system. Y'all can execute the above commands and any existing packages will not be overwritten.
At present that your organization is ready to go, information technology'due south time to start building Python!
Step 3: Build Python
-
Once you accept the prerequisites and the TAR file, you can unpack the source into a directory. Annotation that the following command will create a new directory called
Python-3.viii.iii
under the ane yous're in:$ tar xvf Python-3.viii.4.tgz $ cd Python-iii.8.4
-
Now y'all demand to run the
./configure
tool to prepare the build:$ ./configure --enable-optimizations --with-ensurepip=install
The
enable-optimizations
flag volition enable some optimizations within Python to go far run nigh 10 per centum faster. Doing this may add 20 or xxx minutes to the compilation time. Thewith-ensurepip=install
flag will installpip
arranged with this installation. -
Next, yous build Python using
make
. The-j
option simply tellsbrand
to split the building into parallel steps to speed up the compilation. Fifty-fifty with the parallel builds, this step can have several minutes: -
Finally, you'll want to install your new version of Python. You'll utilise the
altinstall
target here to avoid overwriting the system Python. Since you lot're installing into/usr/bin
, you'll demand to run as root:
It might have a while to terminate installation. Once it's done, you tin verify that Python is prepare up correctly.
Step 4: Verify Your Installation
Test that the python3.8 --version
control returns the latest version:
$ python3.eight --version Python iii.8.4
If you run into Python iii.eight.4
, then you're all set!
If you accept some extra fourth dimension on your hands, yous can also run the test suite to make certain everything is working properly on your system.
To run the exam suite, type the following command:
You'll probably desire to notice something else to do for a while, equally your computer volition be running tests for some time. If all the tests pass, then you can exist confident that your brand-new Python build is working equally expected!
How to Install Python on iOS
The Pythonista app for iOS is a full-fledged Python development surroundings that yous can run on your iPhone or iPad. It features a Python editor, technical documentation, and an interpreter all rolled into a unmarried app.
Pythonista is surprisingly fun to use. It'southward a great trivial tool when y'all're stuck without a laptop and want to work on your Python skills on the get. It comes with the consummate Python 3 standard library and even includes full documentation that y'all can browse offline.
To fix up Pythonista, yous need to download it from the iOS app store.
How to Install Python on Android
If you accept an Android tablet or phone and want to exercise Python on the become, there are several options available. The one that we found nearly reliably supports Python three.8 is Pydroid 3.
Pydroid 3 features an interpreter that you can use for REPL sessions, and it also allows you to edit, save, and execute Python lawmaking.
Y'all tin can download and install Pydroid 3 from the Google Play store. There is a free version and also a paid Premium version that supports code prediction and code analysis.
Online Python Interpreters
If you desire to try out the examples in this tutorial without setting up Python on your machine, then there are several websites that offer an online Python interpreter:
These deject-based Python interpreters may not exist able to execute some of the more complex examples in this tutorial, but they're acceptable for running most of the lawmaking and may exist a nice mode to get started. More information on using these sites is presented in the next tutorial in this series.
Conclusion
Congratulations! You now have access to the latest version of Python for your system. Your Python journeying is just commencement.
In this tutorial y'all've learned how to:
- Check which version of Python, if any, is installed on your system
- Install the latest version of Python on Windows, macOS, and Linux
- Use Python on mobile devices similar phones or tablets
- Use Python on the Spider web with online interpreters
Y'all're now prepare to get started programming in Python! Be sure to share your progress and any questions you lot may take in the comments beneath.
Watch Now This tutorial has a related video grade created by the Real Python team. Watch information technology together with the written tutorial to deepen your agreement: Python Nuts: Setting Up Python
How to Download Python 3.6.2 Tutorial on Mac
Posted by: lynchambegurea.blogspot.com
0 تعليقات