Python용 OR-도구 Pip 사용
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
소개
이 가이드에서는 Python에서 OR 도구를 사용하여
예로 들 수 있습니다
이 도움말은 다른 Windows 변형에서도 작동할 수 있지만
다음 요구사항을 충족하는 머신에서만 테스트했습니다.
다음 기능이 있는 Windows 10 64비트 (x86_64)
- Microsoft Visual Studio Enterprise 2022
- Microsoft Visual Studio Community 2022 Preview 2 이상
기본 요건
다음 섹션에서는 OR 도구 설치를 위한 기본 요건을 설명합니다.
Microsoft Visual C++ 재배포 가능
다음 항목이 있어야 합니다.
Visual Studio 2022용 Microsoft Visual C++ 재배포 가능 패키지 (x64 버전 선택) 설치됨
Python용 OR 도구 라이브러리는
C++ 네이티브 라이브러리
Python
다음 Python 버전 중 하나가 설치되어 있어야 합니다.
그런 다음 PATH에 pip 9.01 이상을 사용할 수 있는지 확인합니다.
python --version
python -c "import platform; print(platform.architecture()[0])"
python -m pip --version
필수 소프트웨어가 Windows에 설치되어 있다고 가정하고 다음 단계를 수행합니다.
python3 -m pip install -U --user ortools
또는 시스템 전체에 설치하려면 다음 단계를 따르세요.
sudo python3 -m pip install -U ortools
OR 도구를 제거하려면 다음 명령어를 실행합니다.
python3 -m pip uninstall ortools
Python 예시 코드 가져오기
예제 코드는 다음 위치에 있습니다.
python_or-tools 저장소가 생성됩니다.
저장소를 ZIP 파일로 다운로드
추출하거나 저장소를 클론합니다.
git clone -b v9.10 --depth 1 https://github.com/or-tools/python_or-tools
예시 디렉터리로 변경합니다.
cd python_or-tools
예 실행
python_or-tools
디렉터리에서 다음을 실행합니다.
다음을 사용하여 바이너리를 실행합니다.
python3 basic_example.py
축하합니다. OR 도구를 사용하여 애플리케이션을 실행했습니다. 이제
OR 도구 시작하기
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-08-29(UTC)
[null,null,["최종 업데이트: 2024-08-29(UTC)"],[[["\u003cp\u003eThis guide provides instructions for installing and running OR-Tools, a Python library for optimization, on a Windows 64-bit system with specified prerequisites.\u003c/p\u003e\n"],["\u003cp\u003eBefore installing OR-Tools, ensure you have the Microsoft Visual C++ Redistributable for Visual Studio 2022 (x64 version) and a compatible 64-bit Python version (3.8.x, 3.9.x, 3.10.x, or 3.11.x) with pip 9.01 or higher.\u003c/p\u003e\n"],["\u003cp\u003eOR-Tools can be installed using pip with the command \u003ccode\u003epython3 -m pip install -U --user ortools\u003c/code\u003e (user-specific) or \u003ccode\u003esudo python3 -m pip install -U ortools\u003c/code\u003e (system-wide).\u003c/p\u003e\n"],["\u003cp\u003eYou can run a basic OR-Tools example by downloading the \u003ccode\u003epython_or-tools\u003c/code\u003e repository, navigating to the \u003ccode\u003eexamples\u003c/code\u003e directory, and executing \u003ccode\u003epython3 basic_example.py\u003c/code\u003e.\u003c/p\u003e\n"]]],["OR-Tools requires Windows 10 64-bit, Microsoft Visual Studio 2022, the Visual C++ Redistributable, and Python (3.8.x to 3.11.x 64-bit). Install OR-Tools using `pip install ortools` or `sudo pip install ortools`. Uninstall with `pip uninstall ortools`. Obtain example code by downloading or cloning the `python_or-tools` repository and navigating to the examples directory. Run the example with `python3 basic_example.py`. Ensure `pip` version is 9.01 or higher.\n"],null,["# Using OR-Tools Pip for Python\n\nIntroduction\n------------\n\nThis guide gets you started with OR-Tools in Python with a simple working\nexample.\n\nAlthough these instructions might also work on other Windows variants, we\nhave only tested them on machines meeting the following requirements:\n\n\nWindows 10 64-bit (x86_64) with:\n\n- Microsoft Visual Studio Enterprise 2022\n- Microsoft Visual Studio Community 2022 Preview 2 or above\n\n\u003cbr /\u003e\n\nPrerequisites\n-------------\n\nThe following sections describe the prerequisites for installing OR-Tools.\n\n### Microsoft Visual C++ Redistributable\n\nYou must have the\n[Microsoft Visual C++ Redistributable for Visual Studio 2022](https://visualstudio.microsoft.com/downloads/?q=Visual+C%2B%2B+Redistributable+for+Visual+Studio) (select the x64 version) installed\non your computer, since OR-Tools library for Python is a wrapper for the\nC++ native library.\n\n### Python\n\nYou must have one of the following versions of Python installed:\n\n- [Python 3.11.x 64-bit](https://www.python.org/downloads/release/python-3110/)\n- [Python 3.10.x 64-bit](https://www.python.org/downloads/release/python-3100/)\n- [Python 3.9.x 64-bit](https://www.python.org/downloads/release/python-390/)\n- [Python 3.8.x 64-bit](https://www.python.org/downloads/release/python-380/)\n\nThen verify that you have pip 9.01 or higher available in your PATH: \n\n python --version\n python -c \"import platform; print(platform.architecture()[0])\"\n python -m pip --version\n\nInstalling OR-Tools\n-------------------\n\nAssuming the prerequisite software is installed on your Windows, take the following steps: \n\n python3 -m pip install -U --user ortools\n\nOr, to install it system wide: \n\n sudo python3 -m pip install -U ortools\n\n### Uninstalling OR-Tools\n\nTo uninstall OR-Tools, issue the following commands: \n\n python3 -m pip uninstall ortools\n\nGet the Python example code\n---------------------------\n\nThe example code is located in the\n[python_or-tools](https://github.com/or-tools/python_or-tools) repository.\n\n1. [Download the repository as a zip file](https://github.com/or-tools/python_or-tools/archive/v9.12.zip)\n and extract it, or clone the repository:\n\n git clone -b v9.12 --depth 1 https://github.com/or-tools/python_or-tools\n\n2. Change to the examples directory:\n\n cd python_or-tools\n\nRun the example\n---------------\n\nFrom the `python_or-tools` directory:\n\nRun the binary using:\n\n\n python3 basic_example.py\n\n\u003cbr /\u003e\n\nCongratulations! You've just run an application with OR-Tools, you are ready to\n[get started with OR-Tools](../../introduction/python)."]]