This guide explains how to install OR-Tools for Python on Windows.
Although these instructions might also work on other Windows variants, we have only tested them on machines meeting the following requirements:
- Windows 10 64-bit (x86_64) with
- Microsoft Visual Studio 2022 or Visual Studio Community 2022
- Microsoft Visual Studio 2019 or Visual Studio Community 2019
Microsoft Visual C++ Redistributable
You must have the Microsoft Visual C++ Redistributable for Visual Studio 2019 (select the x64 version) installed on your computer, since OR-Tools library for Python is a wrapper for the C++ native library.
You must have one of the following versions of Python installed:
- Python 3.10.x 64-bit
- Python 3.9.x 64-bit
- Python 3.8.x 64-bit
- Python 3.7.x 64-bit
- Python 3.6.x 64-bit
Then verify that you have pip 9.01 or higher available in your PATH:
python -c "import platform; print(platform.architecture())"
python -m pip --version
Assuming the prerequisite software is installed on your Windows, take the following steps:
python -m pip install --user ortools
To uninstall OR-Tools, issue the following commands:
python -m pip uninstall ortools
Validate your installation
To test your Python installations, open a x64 Native Tools Command Prompt. Then enter the following command:
python -c "from ortools.linear_solver import pywraplp"
If it runs successfully, you are ready to get started with OR-Tools.