How to use Google-OR-Tools with Python ( Beginner Tutorial)

                                    

Install Python 


Download python here https://www.python.org/downloads/





After downloading find the application to install






Click on the application and install. Please tick the checkbox of "Add Python 3.10 to PATH".




Next open cmd or PowerShell then run $ python --version to make sure it has already been installed






Install Google-OR-Tools


Install the Google-OR-Tools as shown at their website at https://developers.google.com/optimization/install.

By using the Powershell run command $ python -m pip install --upgrade --user ortools







Google-OR-Tools installation complete 


Running Python program 


Then after installing the OR-Tools we can start the code. Furthermore, Google has given a sample script at https://developers.google.com/optimization/introduction/python that we can try.





Use any IDE that you like, for example, I use Sublime. Create a new file paste the script and save it as "program.py"





Next, find the file directory and open the File Explorer. Then by using the Shift + Right Click on Mouse inside the folder.

You will be able to open the PowerShell at the folder directory/location. Choose the "Open PowerShell window here" option.








Finally, run the script by using $ python program.py on the PowerShell.





















Tiada ulasan

Tiada ulasan :

Catat Ulasan