【Untitled】OR-Tools is the easiest to install

Google Optimization Tools (OR-Tools) is a library used to solve combinatorial optimization problems. I have used this package when studying TSN traffic scheduling problems. The following describes the installation of ortools in the python environment and the problems encountered and solutions. plan.

1. Installation

(1) Download and install python and pycharm (other people’s installation tutorials are very detailed, refer to the link below)

https://blog.csdn.net/qq_44809707/article/details/122501118

(2) Download and install visual studio 2019

Refer to the link below. When selecting a workload, just check Desktop development using C++.

https://zhuanlan.zhihu.com/p/94998894

(3) Perform the upgrade pip operation in the pycharm terminal

python -m pip install --upgrade pip

or

python -mpip install --upgrade pip -i https://pypi.douban.com/simple

(Note: Be sure not to circumvent the wall when executing this command, otherwise an error will be reported: ValueError: check_hostname requires server_hostname)

(4) Download the TSNConf project ( https://github.com/nreusch/TSNConf ), open it in pycharm, and run the following commands in the terminal,

pip install -r requirements.txt

If this command runs successfully, it means that ortools can be used in python!

2. Problems encountered

After executing the instructions in step (4), pycharm gave an error that ortools was not installed successfully.

I first tried the method in this link https://blog.csdn.net/li_shusong/article/details/106212345 , but I kept getting errors when executing the fifth step tools\make third_party, and it became even more incorrect later.

In the end, the problem was not solved through this method.

In desperation, I began to wonder if it was a version incompatibility issue. Fortunately, this problem was solved after I changed the versions of python and pycharm. Finally used python 3.9.0, pycharm 2021.1.3. (By the way, if no interpreter appears, you can execute file -> settings... -> python interpreter -> + -> system interpreter -> select the default, and then OK).

3. Conclusion

The issue of version compatibility really needs to be kept in mind, otherwise you will be taken advantage of. Not only will your time be wasted, but you will also feel stupid.

Guess you like

Origin blog.csdn.net/m0_53786448/article/details/128856881