pip. 安装它所需要做的就是运行:
pip install stability-sdkvenvPython 安装附带的模块,创建一个名为“venv”的虚拟环境:
python3 -m venv venvpython3在这里调用来访问“系统”Python 可执行文件。
source venv/bin/activate# prompt before activating
/path/to/current/directory >
# prompt after activating
(venv) /path/to/current/directory >python将访问激活环境的 Python 可执行文件,而不是系统 Python。安装 Python 包——无论是从源代码(如下所述)还是通过 pip——只会影响环境 Python 可执行文件。deactivate。stability-sdk1.从 GitHub克隆存储库...stability-sdk库(从 0.3.0 开始)依赖于 git 子模块。要在克隆时获取这些子模块,请使用--recurse-submodules参数:
git clone --recurse-submodules https://github.com/Stability-AI/stability-sdkgit submodule init
git submodule update--branch:
git clone --branch branchName --recurse-submodules https://github.com/Stability-AI/stability-sdkswitch在克隆后使用该命令拉取并检出到origin远程托管的任何分支(按照这些说明,您的原始远程将设置为https://github.com/stability-ai/stability-sdk.git) 。导航到存储库后:git fetch
git switch branchNamestability-sdk存储库目录...
cd stability-sdk.)作为参数传递:
pip install .-e参数:
pip install -e 。STABILITY_HOST和STABILITY_KEY环境变量...export是 Linux / MacOS 语法。如果您使用的是 Windows,则需要使用该set命令。# Sign up for an account at the following link to get an API Key.
# https://platform.stability.ai/
# Click on the following link once you have created an account to be taken to your API Key.
# https://platform.stability.ai/account/keys
# Paste your API Key below.
export STABILITY_HOST=grpc.stability.ai:443
export STABILITY_KEY=yourkeyhere
python -m stability_sdk generate "A stunning house."