Installation (or setup) of a computer program (including device drivers and plugins), is the act of making the program ready for execution.
This section covers the basics of how to install Python packages.
It’s important to note that the term “package” in this context is being used asa synonym for a distribution (i.e. a bundle ofsoftware to be installed), not to refer to the kind of package that you import in your Python source code (i.e. a container ofmodules). It is common in the Python community to refer to a distribution using the term “package”. Using the term “distribution”is often not preferred, because it can easily be confused with a Linuxdistribution, or another larger software distribution like Python itself.
Contents
This section describes the steps to follow before installing other Pythonpackages.
Before you go any further, make sure you have Python and that the expectedversion is available from your command line. You can check this by running:
You should get some output like Python3.6.3
. If you do not have Python,please install the latest 3.x version from python.org or refer to theInstalling Python section of the Hitchhiker’s Guide to Python.
Note
If you’re a newcomer and you get an error like this:
It’s because this command and other suggested commands in this tutorialare intended to be run in a shell (also called a terminal orconsole). See the Python for Beginners getting started tutorial foran introduction to using your operating system’s shell and interacting withPython.
Note
If you’re using an enhanced shell like IPython or the Jupyternotebook, you can run system commands like those in this tutorial byprefacing them with a !
character:
It’s recommended to write {sys.executable}
rather than plain python
inorder to ensure that commands are run in the Python installation matchingthe currently running notebook (which may not be the same Pythoninstallation that the python
command refers to).
Note
Due to the way most Linux distributions are handling the Python 3migration, Linux users using the system Python without creating a virtualenvironment first should replace the python
command in this tutorialwith python3
and the pip
command with pip3--user
. Do notrun any of the commands in this tutorial with sudo
: if you get apermissions error, come back to the section on creating virtual environments,set one up, and then continue with the tutorial as written.
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, seeInstalling pip/setuptools/wheel with Linux Package Managers.
If pip
isn’t already installed, then first try to bootstrap it from thestandard library:
If that still doesn’t allow you to run pip
:
Securely Download get-pip.py1
Run
pythonget-pip.py
. 2 This will install or upgrade pip.Additionally, it will install setuptools and wheel if they’renot installed already.Warning
Be cautious if you’re using a Python install that’s managed by youroperating system or another package manager. get-pip.py does notcoordinate with those tools, and may leave your system in aninconsistent state. You can use
pythonget-pip.py--prefix=/usr/local/
to install in/usr/local
which is designed for locally-installedsoftware.
While pip
alone is sufficient to install from pre-built binary archives,up to date copies of the setuptools
and wheel
projects are usefulto ensure you can also install from source archives:
See section below for details,but here’s the basic venv3 command to use on a typical Linux system:
This will create a new virtual environment in the tutorial_env
subdirectory,and configure the current shell to use it as the default python
environment.
Python “Virtual Environments” allow Python packages to be installed in an isolated location for a particular application,rather than being installed globally. If you are looking to safely installglobal command line tools,see Installing stand alone command line tools.
Imagine you have an application that needs version 1 of LibFoo, but anotherapplication requires version 2. How can you use both these applications? If youinstall everything into /usr/lib/python3.6/site-packages (or whatever yourplatform’s standard location is), it’s easy to end up in a situation where youunintentionally upgrade an application that shouldn’t be upgraded.
Or more generally, what if you want to install an application and leave it be?If an application works, any change in its libraries or the versions of thoselibraries can break the application.
Also, what if you can’t install packages into theglobal site-packages directory? For instance, on a shared host.
In all these cases, virtual environments can help you. They have their owninstallation directories and they don’t share libraries with other virtualenvironments.
Currently, there are two common tools for creating Python virtual environments:
venv is available by default in Python 3.3 and later, and installspip and setuptools into created virtual environments inPython 3.4 and later.
virtualenv needs to be installed separately, but supports Python 2.7+and Python 3.3+, and pip, setuptools and wheel arealways installed into created virtual environments by default (regardless ofPython version).
The basic usage is like so:
Using venv:
Using virtualenv:
For more information, see the venv docs or the virtualenv docs.
In both of the above cases, Windows users should _not_ use thesource command, but should rather run the activate script directlyfrom the command shell. The use of source under Unix shells ensuresthat the virtual environment’s variables are set within the currentshell, and not in a subprocess (which then disappears, having nouseful effect).
Managing multiple virtual environments directly can become tedious, so thedependency management tutorial introduces ahigher level tool, Pipenv, that automatically manages a separatevirtual environment for each project and application that you work on.
pip is the recommended installer. Below, we’ll cover the most commonusage scenarios. For more detail, see the pip docs,which includes a complete Reference Guide.
The most common usage of pip is to install from the Python PackageIndex using a requirement specifier. Generally speaking, a requirement specifier iscomposed of a project name followed by an optional version specifier. PEP 440 contains a fullspecificationof the currently supported specifiers. Below are some examples.
To install the latest version of “SomeProject”:
To install a specific version:
To install greater than or equal to one version and less than another:
To install a version that’s “compatible”with a certain version: 4
In this case, this means to install any version “1.4.*” version that’s also“>=1.4.2”.
pip can install from either Source Distributions (sdist) or Wheels, but if both are presenton PyPI, pip will prefer a compatible wheel.
Wheels are a pre-built distribution format that provides faster installation compared to SourceDistributions (sdist), especially when aproject contains compiled extensions.
If pip does not find a wheel to install, it will locally build a wheeland cache it for future installs, instead of rebuilding the source distributionin the future.
Upgrade an already installed SomeProject to the latest from PyPI.
To install packages that are isolated to thecurrent user, use the --user
flag:
For more information see the User Installs sectionfrom the pip docs.
Note that the --user
flag has no effect when inside a virtual environment- all installation commands will affect the virtual environment.
If SomeProject
defines any command-line scripts or console entry points,--user
will cause them to be installed inside the user base’s binarydirectory, which may or may not already be present in your shell’sPATH
. (Starting in version 10, pip displays a warning wheninstalling any scripts to a directory outside PATH
.) If the scriptsare not available in your shell after installation, you’ll need to add thedirectory to your PATH
:
On Linux and macOS you can find the user base binary directory by running
python-msite--user-base
and addingbin
to the end. For example,this will typically print~/.local
(with~
expanded to the absolutepath to your home directory) so you’ll need to add~/.local/bin
to yourPATH
. You can set yourPATH
permanently by modifying ~/.profile.On Windows you can find the user base binary directory by running
py-msite--user-site
and replacingsite-packages
withScripts
. Forexample, this could returnC:UsersUsernameAppDataRoamingPython36site-packages
so you wouldneed to set yourPATH
to includeC:UsersUsernameAppDataRoamingPython36Scripts
. You can set your userPATH
permanently in the Control Panel. You may need to log out for thePATH
changes to take effect.
Install a list of requirements specified in a Requirements File.
Install a project from VCS in “editable” mode. For a full breakdown of thesyntax, see pip’s section on VCS Support.
Install from an alternate index
Search an additional index during install, in addition to PyPI
Installing from local src in Development Mode,i.e. in such a way that the project appears to be installed, but yet isstill editable from the src tree.
You can also install normally from src
Install a particular source archive file.
Install from a local directory containing archives (and don’t check PyPI)
To install from other data sources (for example Amazon S3 storage) you cancreate a helper application that presents the data in a PEP 503 compliantindex format, and use the --extra-index-url
flag to direct pip to usethat index.
Find pre-release and development versions, in addition to stable versions. Bydefault, pip only finds stable versions.
Install setuptools extras.
“Secure” in this context means using a modern browser or atool like curl that verifies SSL certificates when downloading fromhttps URLs.
Depending on your platform, this may require root or Administratoraccess. pip is currently considering changing this by making userinstalls the default behavior.
Beginning with Python 3.4, venv
(a stdlib alternative tovirtualenv) will create virtualenv environments with pip
pre-installed, thereby making it an equal alternative tovirtualenv.
The compatible release specifier was accepted in PEP 440and support was released in setuptools v8.0 andpip v6.0
Office for home Some Office for home products come with a product key. If yours did, before installing Office for the first time, sign in with an existing or new Microsoft account and enter your product key* at office.com/setup. Redeeming your key is what links your account with Office so you only have to do this once. Already did this? Go to Step 1.
Office for business If your Office for business subscription plan includes the desktop version of the Office apps you won't see an option to install it unless someone in your organization assigned a license to you. Learn how to check this in What Office 365 business product or license do I have? or if you're an Office 365 admin, see Assign licenses to users.
Note: *Some versions of Office such as Office Professional Plus 2019, Office Standard 2019, or a stand-alone app such as Word 2019 or Project 2019 don't have an associated account. The steps to install these versions can be different depending if you got Office through one of the following ways:
Microsoft HUP: You bought Office for personal use through your company and have a product key, see Install Office through HUP.
Volume license versions: IT departments might use a different method to install Office for people in their organization. Talk to your IT department for install help.
Third-party seller: You bought Office from a third-party and you're having problems with the product key.
Before you begin, make sure your PC or Mac meets the system requirements.
Sign in to download Office
Go to www.office.com and if you're not already signed in, select Sign in.
Sign in with the account you associated with this version of Office. This account can be a Microsoft account, or work or school account. I forgot the account I use with Office
After signing in, follow the steps that match the type of account you signed in with.
You signed in with a Microsoft account
From the Office home page select Install Office.
Select Install (or depending on your version, Install Office>).
You signed in with a work or school account
From the Office 365 home page select Install Office apps (If you set a different start page, go to aka.ms/office-install.)
Select Office 365 apps to begin the installation.
Tip: The 64-bit version is installed by default unless Office detects you already have a 32-bit version of Office (or a stand-alone Office app such as Project or Visio) installed. In this case, the 32-bit version of Office will be installed instead.
To change from a 32-bit version to a 64-bit version or vice versa, you need to uninstall Office first (including any stand-alone Office apps you have such as Project of Visio). Once the uninstall is complete, sign in again to www.office.com and select Other install options, choose the language and version you want (64 or 32-bit), and then select Install. (See Install Visio or Install Project if you need to reinstall those stand-alone apps.)This completes the download of Office to your device. To complete the installation, follow the prompts in the 'Install Office' section below.
Tip:Don't see an install option after signing in? There could be an issue with your account. Select Need help? from above and review the solutions under Account questions.
Install Office
Depending on your browser, select Run (in Edge or Internet Explorer), Setup (in Chrome), or Save File (in Firefox).
If you see the User Account Control prompt that says, Do you want to allow this app to make changes to your device? select Yes.
The install begins.
Your install is finished when you see the phrase, 'You're all set! Office is installed now' and an animation plays to show you where to find Office applications on your computer. Select Close.
Installation or sign in issues?
If you're having an installation issue such as Office taking long to install, try Need help? for a list of common issues.
Activate Office
To open an Office app, select the Start button (lower-left corner of your screen) and type the name of an Office app, like Word.
If you have Windows 8.1 or 8.0, type the name of an Office app on the Start screen. Can't find your Office apps?
To open the Office app, select its icon in the search results.
When the Office app opens, accept the license agreement. Office is activated and ready to use.
Note: The Activation Wizard appears if Office has trouble activating. Complete the steps in the wizard to finish activating Office.
Sign in and install Office
Go to www.office.com and if you're not already signed in, select Sign in.
Note: If you bought Office for personal use through your company's Microsoft HUP benefit, you may not be able to sign in here. Find installation help at Install Office through HUP.
Sign in with the account you associated with this version of Office. This account can be a Microsoft account, or work or school account. I forgot the account I use with Office
After signing in, follow the steps that match the type of account you signed in with.
You signed in with a Microsoft account
From the Office home page select Install Office to start the download.
You signed in with a work or school account
From the Office 365 home page select Install Office apps (if you set a different start page, go to aka.ms/office-install).
Select Office 365 apps to begin the download.
Note:Don't see an install option after signing in? There could be an issue with your account. Select Need help? from above and review the issues listed in the section Account questions.
Follow the instructions below to complete installing your Office apps.
Install Office
Once the download has completed, open Finder, go to Downloads, and double-click Microsoft Office installer.pkg file (the name might vary slightly).
Tip: If you see an error that says the Microsoft Office installer.pkg can't be opened because it is from an unidentified developer, wait 10 seconds and move the downloaded file to your desktop. Hold Control + click the file to launch the installer.
On the first installation screen, select Continue to begin the installation process.
Review the software license agreement, and then click Continue.
Select Agree to agree to the terms of the software license agreement.
Choose how you want to install Office and click Continue.
Review the disk space requirements or change your install location, and then click Install.
Note: If you want to only install specific Office apps and not the entire suite, click the Customize button and uncheck the programs you don't want.
Enter your Mac login password, if prompted, and then click Install Software. (This is the password that you use to log in to your Mac.)
The software begins to install. Click Close when the installation is finished. If Office installation fails, see What to try if you can't install or activate Office for Mac.
Launch an Office for Mac app and start the activation process
Click the Launchpad icon in the Dock to display all of your apps.
Click the Microsoft Word icon in the Launchpad.
The What's New window opens automatically when you launch Word. Click Get Started to start activating. If you need help activating Office, see Activate Office for Mac. If Office activation fails, see What to try if you can't install or activate Office for Mac.
Installation notes
Installation notes
How do I pin the Office app icons to the dock?
Go to Finder > Applications and open the Office app you want.
In the Dock, Control+click or right-click the app icon and choose Options > Keep in Dock.
Can I install Office on my iPhone or iPad?
Yes, see Install and set up Office on an iPhone or iPad and set up email on an iOS device (iPhone or iPad).
Sign in or installation FAQ
The following are a few of the more common questions or issues when trying to install Office.
Tip: Don't see your issue listed? Try Troubleshoot installing Office for additional issues and their possible solutions.
Account questions:
I don't have a Microsoft account yet, or I forgot my username or password
Before you can install Office 365 or Office 2019 you need to associate it with a Microsoft account, or work or school account.
If you have an Office for home product and bought Office at a retail store or online store, but don't have a Microsoft account, it's possible you haven't redeemed your product key yet (if you got one), or you missed the step for linking your recent purchase with an account. Do the following to link an account with Office.
For an Office for home product, go to office.com/setup and create a new Microsoft account or sign in with an existing one, then follow the remaining steps on that page such as entering your product key (if you have one). Your account is successfully associated with Office when you see the page, My Office Account followed by your Microsoft account email address, and a button to install Office. Select the PC or Mac tabs above to help you with the rest of the install process.
If the Microsoft account or work or school account isn't working, see I forgot the username or password for the account I use with Office.
I don't see an option to install Office after signing in with my work or school account
After signing in with your work or school account you don't see an option to install the desktop applications on the Office 365 home page, go directly to the Office 365 Software page instead. Select the language and bit-version you want (PC users can choose between 32-bit and 64-bit), and then click Install. See Step 2 and 3 on the PC or Mac tabs above to help you with the rest of the install process.
Notes:
If your organization uses Office 365 operated by 21Vianet in China, sign in to the Office 365 Software page at https://portal.partner.microsoftonline.cn/OLS/MySoftware.aspx.
If your organization uses Office 365 Germany, sign in to the Office 365 Software page at https://portal.office.de/OLS/MySoftware.aspx.
If you still don't see an option to install Office on the Office 365 Software page, it's possible your admin hasn't assigned a license to you. Find out if you have a license to install Office.
If you're a student or teacher and your institution didn't give you a license, find out if you're eligible to Get Office 365 for free.
I can't sign in with my work or school account
If you're trying to sign in with your work or school account to www.office.com and your sign in is blocked, it likely means your Office 365 administrator set up a security policy that's preventing you from signing in to that location.
To install Office, try signing in directly to the Office 365 Software page instead. Select the language and bit-version you want (PC users can choose between 32-bit and 64-bit), and then click Install. See Steps 2 and 3 on the PC or Mac tabs above to help you with the rest of the install process.
Notes:
If your organization uses Office 365 operated by 21Vianet in China, sign in to the Office 365 Software page at https://portal.partner.microsoftonline.cn/OLS/MySoftware.aspx.
If your organization uses Office 365 Germany, sign in to the Office 365 Software page at https://portal.office.de/OLS/MySoftware.aspx.
If you're still not able to sign in, contact your administrator.
Product key, purchase, and installing older versions of Office:
Product keys for Office
Not all versions of Office include a key, but if yours did, you need to redeem it before you can install Office. Go to office.com/setup and sign in with an existing Microsoft account or create a new one, then enter your product key. Follow the remaining prompts to finish linking your Microsoft account with this version of Office.
No product key or not sure if you need one? See Using product keys with Office.
How do I buy the latest version of Office?
The steps in this topic assume you have Office 365 or Office 2019 and you're ready to install or reinstall it. Don't have the latest version yet?
Learn more about the differences between Office 365 and non-subscription versions.
How do I install Office 2013, Office 2010, or Office 2007
Installation help for older versions of Office:
Install questions or errors during install
How many computers can I install Office on?
For Office 365 for home subscribers only: You can install Office on all your devices and be signed in to five at the same time. To learn more, see How sign in works in Office 365.
If you have Office 365 Home, you can share your Office 365 Home subscription with up to five family members or other people. Each person can install Office on all their devices and be signed in to five at the same time.
How To Install New Software
For a one-time purchase of Office such as Office Home & Student, Office Home & Business, or Office Professional: You can install these non-subscription versions of Office on only one computer. However, you may transfer Office to another computer that belongs to you if you experience a hardware failure or you buy a new computer. For more information, see the Microsoft License Terms for your product, or see this blog post, Office now transferable.
Check you have administrator rights on your computer
When installing Office on a PC, you must be an administrator on the PC computer where you want to install Office. If you're not sure, see Check if you have local admin rights to install Office.
How do I install stand-alone office apps such as Visio or Project?
If you bought a stand-alone version of an Office app, for example Visio or Word, in most cases you install this app in the same way you install the Office suite, by signing in to www.office.com with your Microsoft account, or work or school account and selecting Install for your stand-alone product.
If you have a subscription to Project Online Professional, Project Online Premium, or Visio Pro for Office 365, see Install Project, or Install Visio for the steps to install the apps that are part of those subscriptions.
How do I install Office on my mobile device?
The Office apps are available to install on your iPhone and iPad, Android device, or Windows phone and tablet. See Set up Office apps and email on a mobile device.
Office is taking very long to install
If Office seems to be taking a very long time to install, this may be caused by problems with your internet connection, firewall, or anti-virus software. For possible solutions, see Office is taking long to install.
Office can also take long to install because of a slow internet connection (such as a dial-up connection). If you don't have a good connection, install Office using the Use the Office offline installer.
I received an error during install
Office won't install: Your computer must be running a supported operating system to install Office. You can find a list of which systems are supported on the system requirements page. For example, your install won't be successful if you're trying to install Office on a computer running Windows Vista or Windows XP operating system. If your computer can't install the full desktop version of Office, try the free Office Online apps using your desktop browser.
I received an error message: If you got an error message while trying to install Office and it has a Learn More link, select it to get information for how to troubleshoot that particular error. If there wasn't a link, see Troubleshoot installing Office.
I received an unsupported operating system message: If you got an unsupported operating system error message you may be trying to install Office on an unsupported device such as installing the Mac version of Office on a PC or vice versa, or trying to install Office on a Chromebook or other mobile device. See Unsupported operating system error when installing Office or Set up Office apps and email on a mobile device.
Help with specific applications, and help for Office 365 admins:
I've installed Office, but I don't see OneNote
OneNote for Windows 10 is the default OneNote experience for Office 365 and Office 2019 customers. For information about how to download the desktop version of OneNote 2016 see OneNote is missing after installing Office 2019 or Office 365.
Learn more about the differences between these two versions in What's the difference between OneNote and OneNote 2016?
Office is installed, but I'm not sure how to do something or want to learn more
If Office is installed, but you need help with Office basics, or learn how to do a specific task such as print a document, set up an account in Outlook, or use VLOOKUP in Excel, go to the top of this page and select Apps or Learn Office.
You can also type what you're looking for using the search bar in the upper-right corner.
I'm an Office 365 admin, how do I assign licenses to users in my organization or buy more licenses?
Install Https On Ipad
If you're the Office 365 admin of an Office for business plan, users in your organization can only install Office using the steps in this topic as long as your plan includes the desktop version of Office, and you've assigned the user a license and given them permission to install Office (Manage software download settings in Office 365).
Install Https Ubuntu
For information about how to assign licenses, see Assign licenses to users in Office 365 for business.
If you've run out of licenses and need to purchase more, see Buy licenses for your Office 365 for business subscription.
Contact Microsoft
Install Https Certificate
If you weren't able to resolve your problem, try contacting Microsoft support.