[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[],[],null,["\u003cbr /\u003e\n\nNode.js Python \n\n\u003cbr /\u003e\n\nThere are two ways to specify dependencies for Cloud Functions written in\nPython: using the [pip](https://pip.pypa.io/en/stable/) package manager's\n`requirements.txt` file or packaging local dependencies alongside your function.\n\nDependency specification using the Pipfile/Pipfile.lock standard is\nnot supported. Your project should not include these files.\n\nSpecifying dependencies with pip\n\nDependencies in Python are managed with pip and expressed in a metadata file\ncalled\n[`requirements.txt`](https://pip.pypa.io/en/stable/user_guide/#requirements-files).\nThis file must be in the same directory as the `main.py` file that contains your\nfunction code.\n\nWhen you deploy or redeploy your function, Cloud Functions\nuses pip to download and install the latest version of your\ndependencies as declared in the `requirements.txt` file.\nThe `requirements.txt` file contains one line per package. Each line contains\nthe package name, and optionally, the requested version. For more details, see\nthe [`requirements.txt`\nreference](https://pip.pypa.io/en/stable/user_guide/#requirements-files).\n\nTo prevent your build from being affected by dependency version changes,\nconsider pinning your dependency packages to a specific version.\n\nThe following is an example `requirements.txt` file: \n\n```\nfunctions-framework\nrequests==2.20.0\nnumpy\n```\n\nThe [Functions Framework](/functions/docs/functions-framework) is a\nrequired dependency for all functions. Although Cloud Functions\ninstalls it on your behalf when the function is created, we recommend\nthat you include it as an explicit dependency for clarity.\n\nIf your\nfunction relies on private dependencies, we recommend that you\nmirror `functions-framework` to your private registry. Include the mirrored\n`functions-framework` as a dependency to your function to avoid installing the\npackage from the public internet.\n\nPackaging local dependencies\n\nYou can also package and deploy dependencies alongside your function. This\napproach is useful if your dependency is not available via the pip\npackage manager or if your Cloud Functions environment's internet\naccess is restricted.\n| **Note:** You can still use a `requirements.txt` file to specify additional dependencies you haven't packaged alongside your function.\n\nFor example, you might use a directory structure\nsuch as the following: \n\n```\nmyfunction/\n├── main.py\n└── localpackage/\n ├── __init__.py\n └── script.py\n```\n\nYou can then import the code as usual from `localpackage` using the following\n`import` statement. \n\n```py\n# Code in main.py\nfrom localpackage import script\n```\n\nNote that this approach will *not* run any `setup.py` files. Packages with those\nfiles can still be bundled, but may not run correctly on Cloud Functions.\n\n\u003cbr /\u003e"]]