This guide is written for Python 3, however, these instructions should work fine on Python 2.7—if you are still using it, for some reason. Make sure you’ve got Python & pip ¶ Before you go any further, make sure you have Python and that it’s available from your command line. Installing Anaconda using a graphical installer is probably the easiest way to install Anaconda. 1 ‒ Go to the Anaconda Website and choose a Python 3.x graphical installer (A) or a Python 2.x graphical installer (B). If you aren’t sure which Python version you want to install, choose Python 3. Do not choose both. Windows users: If installing Python 3.6 as a non-privileged user, you may need to escalate to administrator privileges to install an update to your C runtime libraries. Windows users: There are now 'web-based' installers for Windows platforms; the installer will download the needed software components at installation time.
Release Date: Dec. 19, 2017
Python 3.6.4 was the fourth maintenance release of Python 3.6.
There are now newer security-fix releases of Python 3.6 that supersede 3.6.4 and Python 3.8 is now the latest feature release of Python 3. Get the latest releases of 3.6.x and 3.8.x here. Python 3.6.8 is planned to be the last bugfix releasefor 3.6.x. Following the release of 3.6.8, we plan to provide security fixes for Python 3.6 as needed through 2021, five years following its initial release.
Among the new major new features in Python 3.6 were:
Install Python 3 Mac
- PEP 468, Preserving Keyword Argument Order
- PEP 487, Simpler customization of class creation
- PEP 495, Local Time Disambiguation
- PEP 498, Literal String Formatting
- PEP 506, Adding A Secrets Module To The Standard Library
- PEP 509, Add a private version to dict
- PEP 515, Underscores in Numeric Literals
- PEP 519, Adding a file system path protocol
- PEP 520, Preserving Class Attribute Definition Order
- PEP 523, Adding a frame evaluation API to CPython
- PEP 524, Make os.urandom() blocking on Linux (during system startup)
- PEP 525, Asynchronous Generators (provisional)
- PEP 526, Syntax for Variable Annotations (provisional)
- PEP 528, Change Windows console encoding to UTF-8
- PEP 529, Change Windows filesystem encoding to UTF-8
- PEP 530, Asynchronous Comprehensions
- PEP 494, 3.6 Release Schedule
- Report bugs at https://bugs.python.org.
- Help fund Python and its community.
Notes on this release
- Windows users: The binaries for AMD64 will also work on processors that implement the Intel 64 architecture. (Also known as the 'x64' architecture, and formerly known as both 'EM64T' and 'x86-64'.)
- Windows users: If installing Python 3.6 as a non-privileged user, you may need to escalate to administrator privileges to install an update to your C runtime libraries.
- Windows users: There are now 'web-based' installers for Windows platforms; the installer will download the needed software components at installation time.
- Windows Users: There are redistributable zip files containing the Windows builds, making it easy to redistribute Python as part of another software package. Please see the documentation regarding Embedded Distribution for more information.
- macOS users: If you are using the Python 3.6 from the python.org binary installer linked on this page, please carefully read the Important Information displayed during installation; this information is also available after installation by clicking on /Applications/Python 3.6/ReadMe.rtf. There is important information there about changes in the 3.6 installer-supplied Python, particularly with regard to SSL certificate validation.
- macOS users: There is important information about IDLE, Tkinter, and Tcl/Tk on macOS here.
Version | Operating System | Description | MD5 Sum | File Size | GPG |
---|---|---|---|---|---|
Gzipped source tarball | Source release | 9de6494314ea199e3633211696735f65 | 22710891 | SIG | |
XZ compressed source tarball | Source release | 1325134dd525b4a2c3272a1a0214dd54 | 16992824 | SIG | |
Mac OS X 64-bit/32-bit installer | Mac OS X | for Mac OS X 10.6 and later | 9fba50521dffa9238ce85ad640abaa92 | 27778156 | SIG |
Windows help file | Windows | 17cc49512c3a2b876f2ed8022e0afe92 | 8041937 | SIG | |
Windows x86-64 embeddable zip file | Windows | for AMD64/EM64T/x64, not Itanium processors | d2fb546fd4b189146dbefeba85e7266b | 7162335 | SIG |
Windows x86-64 executable installer | Windows | for AMD64/EM64T/x64, not Itanium processors | bee5746dc6ece6ab49573a9f54b5d0a1 | 31684744 | SIG |
Windows x86-64 web-based installer | Windows | for AMD64/EM64T/x64, not Itanium processors | 21525b3d132ce15cae6ba96d74961b5a | 1320128 | SIG |
Windows x86 embeddable zip file | Windows | 15802be75a6246070d85b87b3f43f83f | 6400788 | SIG | |
Windows x86 executable installer | Windows | 67e1a9bb336a5eca0efcd481c9f262a4 | 30653888 | SIG | |
Windows x86 web-based installer | Windows | 6c8ff748c554559a385c986453df28ef | 1294088 | SIG |
This tutorial walks you through installing and using Python packages.
It will show you how to install and use the necessary tools and make strongrecommendations on best practices. Keep in mind that Python is used for a greatmany different purposes, and precisely how you want to manage your dependenciesmay change based on how you decide to publish your software. The guidancepresented here is most directly applicable to the development and deployment ofnetwork services (including web applications), but is also very well suited tomanaging development and testing environments for any kind of project.
Note
This guide is written for Python 3, however, these instructionsshould work fine on Python 2.7—if you are still using it, for some reason.
Make sure you’ve got Python & pip¶
Before you go any further, make sure you have Python and that it’s availablefrom your command line. You can check this by simply running:
You should get some output like 3.6.2
. If you do not have Python, pleaseinstall the latest 3.x version from python.org or refer to theInstalling Python section of this guide.
Note
Installing Python 3.6 Mac
If you’re newcomer and you get an error like this:
It’s because this command is intended to be run in a shell (also calleda terminal or console). See the Python for Beginnersgetting started tutorial for an introduction to using your operatingsystem’s shell and interacting with Python.
Additionally, you’ll need to make sure you have pip available. You cancheck this by running:
If you installed Python from source, with an installer from python.org, orvia Homebrew you should already have pip. If you’re on Linux and installedusing your OS package manager, you may have to install pip separately.
Installing Pipenv¶
Pipenv is a dependency manager for Python projects. If you’re familiarwith Node.js’ npm or Ruby’s bundler, it is similar in spirit to thosetools. While pip can install Python packages, Pipenv is recommended asit’s a higher-level tool that simplifies dependency management for common usecases.
Use pip
to install Pipenv:
Note
This does a user installation to prevent breaking any system-widepackages. If pipenv
isn’t available in your shell after installation,you’ll need to add the user base’s binary directory to your PATH
.
On Linux and macOS you can find the user base binary directory by runningpython-msite--user-base
and adding bin
to the end. For example,this will typically print ~/.local
(with ~
expanded to theabsolute path to your home directory) so you’ll need to add~/.local/bin
to your PATH
. You can set your PATH
permanently bymodifying ~/.profile.
On Windows you can find the user base binary directory by runningpy-msite--user-site
and replacing site-packages
withScripts
. For example, this could returnC:UsersUsernameAppDataRoamingPython36site-packages
so you wouldneed to set your PATH
to includeC:UsersUsernameAppDataRoamingPython36Scripts
. You can set youruser PATH
permanently in the Control Panel. You may need to logout for the PATH
changes to take effect.
Installing packages for your project¶
Pipenv manages dependencies on a per-project basis. To install packages,change into your project’s directory (or just an empty directory for thistutorial) and run:
Pipenv will install the excellent Requests library and create a Pipfile
for you in your project’s directory. The Pipfile is used to track whichdependencies your project needs in case you need to re-install them, such aswhen you share your project with others. You should get output similar to this(although the exact paths shown will vary):
Using installed packages¶
Now that Requests is installed you can create a simple main.py
file touse it:
Then you can run this script using pipenvrun
:
You should get output similar to this:
Using $pipenvrun
ensures that your installed packages are available toyour script. It’s also possible to spawn a new shell that ensures all commandshave access to your installed packages with $pipenvshell
.
Next steps¶
Congratulations, you now know how to install and use Python packages! ✨ 🍰 ✨