Vertex AI SDK for Python을 사용하면 데이터 수집을 자동화하고 모델을 학습시켜 Vertex AI에서 예측을 가져올 수 있습니다. Vertex AI SDK는 Python 코드를 사용하여 Vertex AI API에 액세스하므로 Google Cloud 콘솔에서 수행할 수 있는 대부분의 작업을 프로그래매틱 방식으로 수행할 수 있습니다.
Vertex AI SDK for Python은 숙련된 머신러닝(ML) 및 인공지능(AI) 엔지니어 또는 워크플로를 프로그래매틱 방식으로 자동화하려는 데이터 과학자에게 권장됩니다. Vertex AI SDK for Python은 Vertex AI SDK가 더 상위 레벨이고 덜 세분화되어 있다는 점을 제외하고 Vertex AI Python 클라이언트 라이브러리와 유사합니다. 자세한 내용은 SDK와 클라이언트 라이브러리의 차이점 이해를 참조하세요.
Vertex AI SDK for Python으로 코드 작성
Vertex AI SDK for Python을 사용하려면 다음 안내를 따르세요.
가상 환경에서 다음 명령어를 실행하여 Vertex AI SDK for Python 및 Vertex AI Python 클라이언트 라이브러리가 모두 포함된 google-cloud-aiplatform 패키지를 설치합니다.
pipinstall--upgradegoogle-cloud-aiplatform
다음 코드를 사용하여 google.cloud.aiplatform 네임스페이스를 가져옵니다.
fromgoogle.cloudimportaiplatform
If you're using a local shell, then create local authentication credentials for your user
account:
gcloudauthapplication-defaultlogin
You don't need to do this if you're using Cloud Shell.
Vertex AI용 Python 참조: Vertex AI SDK, Vertex AI SDK 미리보기, Vertex AI 클라이언트 라이브러리를 포함한 google-cloud-aiplatform 패키지의 모든 네임스페이스, 클래스, 메서드, 속성에 대한 참고 문서가 포함됩니다.
코드 샘플 및 튜토리얼 사용해 보기
Jupyter 노트북 튜토리얼에서는 Vertex AI SDK for Python을 더 큰 워크플로의 일부로 사용하는 방법을 보여줍니다. 자세한 내용은 Vertex AI 노트북 가이드를 참조하세요.
Vertex AI SDK for Python을 설치하면 Vertex AI Python 클라이언트 라이브러리도 설치됩니다. Vertex AI SDK와 Vertex AI Python 클라이언트 라이브러리는 서로 다른 수준의 세부사항으로 유사한 기능을 제공합니다. Vertex AI SDK는 클라이언트 라이브러리보다 높은 추상화 수준에서 작동하며 대부분의 일반적인 데이터 과학 워크플로에 적합합니다. 하위 수준 기능이 필요하면 Vertex AI Python 클라이언트 라이브러리를 사용합니다.
Vertex AI SDK는 Python에서, Vertex AI 클라이언트 라이브러리는 Python, 자바, Node.js에서 사용할 수 있습니다. Java 또는 Node.js 클라이언트 라이브러리를 설치하는 방법은 Vertex AI 클라이언트 라이브러리 설치를 참조하세요.
선호하는 프로그래밍 언어로 클라이언트 라이브러리를 사용할 수 없는 경우 Vertex AI REST API를 사용할 수 있습니다. 자세한 내용은 Vertex AI REST 참조를 확인하세요.
Vertex AI Python 클라이언트 라이브러리와 SDK 함께 사용
Vertex AI SDK for Python을 사용하여 더 높은 수준의 유연성 또는 제어 기능이 필요하거나 Vertex AI SDK에 포함되지 않은 메서드가 필요한 경우 동일한 워크플로에서 Vertex AI Python 클라이언트 라이브러리를 사용할 수 있습니다. Vertex AI Python 클라이언트 라이브러리는 다른 네임스페이스를 사용하여 Vertex AI API에 액세스합니다. Python 스크립트의 각 항목에 import 줄을 추가하여 같은 Python 스크립트에서 클라이언트 라이브러리와 Vertex AI SDK for Python 네임스페이스를 사용할 수 있습니다.
Vertex AI Python 클라이언트 라이브러리 네임스페이스 가져오기
Vertex AI Python 클라이언트 라이브러리 네임스페이스는 google.cloud.aiplatform.gapic입니다. 이 네임스페이스는 google.cloud.aiplatform_v1 네임스페이스에 매핑됩니다. 이 두 네임스페이스는 서로 바꿔서 사용할 수 있습니다. Python 클라이언트 라이브러리를 가져오려면 Python 스크립트에 다음 중 하나를 포함합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[],[],null,["# Introduction to the Vertex AI SDK for Python\n\nThe Vertex AI SDK for Python helps you automate data ingestion, train models, and\nget predictions on Vertex AI. The Vertex AI SDK uses Python code to\naccess the Vertex AI API so that you can programmatically accomplish most of what\nyou can do in the Google Cloud console.\n\nTo learn how to install or update the Vertex AI SDK for Python, see [Install the\nVertex AI SDK for Python](/vertex-ai/docs/start/install-sdk). For more information, see\nthe [Vertex AI SDK for Python API reference documentation](/python/docs/reference/aiplatform/latest).\n\nWhy use the Vertex AI SDK\n-------------------------\n\nThe Vertex AI SDK for Python is recommended if you're an experienced machine\nlearning (ML) and artificial intelligence (AI) engineer or a data scientist who\nwants to programmatically automate your workflow. The Vertex AI SDK for Python is\nsimilar to the Vertex AI Python client library, except the\nVertex AI SDK is higher-level and less granular. For more information, see\n[Understand the SDK and client library differences](#sdk-vs-client-library).\n\n\u003cbr /\u003e\n\nWrite code with the Vertex AI SDK for Python\n--------------------------------------------\n\nTo use the Vertex AI SDK for Python:\n\n1. Install the `google-cloud-aiplatform` package, which includes both the Vertex AI SDK for Python and the Vertex AI Python client library, by running the following command in your virtual environment:\n\n pip install --upgrade google-cloud-aiplatform\n\n2. Use the following code to import the `google.cloud.aiplatform` namespace:\n\n from google.cloud import aiplatform\n\n | **Preview:** To use features for the Vertex AI SDK for Python that are still in [preview](/products#product-launch-stages), import `vertexai.preview`: \n |\n | ```python\n | import vertexai.preview\n | ```\n\n \u003cbr /\u003e\n\n3.\n\n If you're using a local shell, then create local authentication credentials for your user\n account:\n\n ```bash\n gcloud auth application-default login\n ```\n\n You don't need to do this if you're using Cloud Shell.\n\n\n If an authentication error is returned, and you are using an external identity provider\n (IdP), confirm that you have\n [signed in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n### Learn about the Vertex AI SDK for Python\n\nSee the following documentation:\n\n- [Vertex AI SDK class overview](/vertex-ai/docs/python-sdk/python-sdk-class-overview): introduces the key classes and functionality in the Vertex AI SDK.\n\n- [Python reference for Vertex AI](/python/docs/reference/aiplatform/latest): contains reference documentation for all of the namespaces, classes, methods, and properties in the `google-cloud-aiplatform` package, which includes the Vertex AI SDK, the Vertex AI SDK preview, and the Vertex AI Client libraries.\n\n### Try code samples and tutorials\n\nNotebook tutorials show how to use the Vertex AI SDK for Python as part of a\nlarger workflow. For more information, see\n[Vertex AI notebook tutorials](/vertex-ai/docs/tutorials/jupyter-notebooks).\n\nCode samples in the Vertex AI SDK for Python GitHub repository show you how to\ncomplete individual tasks. For more information, see the\n[Vertex AI SDK for Python GitHub repository](https://github.com/googleapis/python-aiplatform/). \n| To see an example of using the Vertex AI SDK as part of a more comprehensive workflow,\n| run the \"Custom training and online prediction\" notebook in one of the following\n| environments:\n|\n| [Open in Colab](https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/custom/sdk-custom-image-classification-online.ipynb)\n|\n|\n| \\|\n|\n| [Open in Colab Enterprise](https://console.cloud.google.com/vertex-ai/colab/import/https%3A%2F%2Fraw.githubusercontent.com%2FGoogleCloudPlatform%2Fvertex-ai-samples%2Fmain%2Fnotebooks%2Fofficial%2Fcustom%2Fsdk-custom-image-classification-online.ipynb)\n|\n|\n| \\|\n|\n| [Open\n| in Vertex AI Workbench](https://console.cloud.google.com/vertex-ai/workbench/deploy-notebook?download_url=https%3A%2F%2Fraw.githubusercontent.com%2FGoogleCloudPlatform%2Fvertex-ai-samples%2Fmain%2Fnotebooks%2Fofficial%2Fcustom%2Fsdk-custom-image-classification-online.ipynb)\n|\n|\n| \\|\n|\n| [View on GitHub](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/custom/sdk-custom-image-classification-online.ipynb)\n\nUnderstand the Vertex AI SDK and client library differences\n-----------------------------------------------------------\n\nWhen you install the Vertex AI SDK for Python, the Vertex AI Python client\nlibrary is also installed. The Vertex AI SDK and the\nVertex AI Python client library provide similar functionality with\ndifferent levels of granularity. The Vertex AI SDK operates at a\nhigher level of abstraction than the client library and is suitable for most\ncommon data science workflows. If you need lower-level functionality, then use\nthe Vertex AI Python client library.\n\nThe Vertex AI SDK is available for Python and a Vertex AI client\nlibrary is available for Python, Java, and Node.js. To learn how to install the\nJava or Node.js client library, see\n[Install the Vertex AI client libraries](/vertex-ai/docs/start/client-libraries).\nIf a client library isn't available in your preferred programming language, you\ncan use the Vertex AI REST API. For more information, see the\n[Vertex AI REST reference](/vertex-ai/docs/reference/rest).\n\n### Use Vertex AI Python client library and SDK together\n\nIf you use the Vertex AI SDK for Python and discover you need greater flexibility\nor control, or if you need a method not included in the Vertex AI SDK, you\ncan use the Vertex AI Python client library in the same workflow. The\nVertex AI Python client library uses a different namespace to access the\nVertex AI API. The client library and the Vertex AI SDK for Python\nnamespaces can be used in the same Python script by adding an `import` line for\neach in your Python script.\n\n### Import the Vertex AI Python client library namespace\n\nThe Vertex AI Python client library namespace is\n`google.cloud.aiplatform.gapic`. This namespace maps to the\n`google.cloud.aiplatform_v1` namespace. These two namespaces can be used\ninterchangeably. To import the Python client library, include one of the\nfollowing in your Python script: \n\n```\nfrom google.cloud import aiplatform_v1\n``` \n\n```\nfrom google.cloud.aiplatform import gapic\n```\n\nWhat's next\n-----------\n\n- Learn how to [choose a training method](/vertex-ai/docs/start/training-methods)."]]