如何在创建ai平台笔记本时安装python库
我想在GCP中创建笔记本实例时使用“选择创建后运行的脚本” 具体来说,我想用它来安装python软件包如何在创建ai平台笔记本时安装python库,python,google-cloud-platform,script,gcp-ai-platform-notebook,Python,Google Cloud Platform,Script,Gcp Ai Platform Notebook,我想在GCP中创建笔记本实例时使用“选择创建后运行的脚本” 具体来说,我想用它来安装python软件包 我需要编写什么样的脚本(扩展和内容)?这是安装Voila的启动后脚本的一个示例。 将此文件保存在GCS存储桶中,并在创建笔记本时定义路径,例如: gcloud notebooks instances create nb-1 \ '--vm-image-project=deeplearning-platform-release' \ '--vm-image-family=tf2-latest-c
我需要编写什么样的脚本(扩展和内容)?这是安装Voila的启动后脚本的一个示例。 将此文件保存在GCS存储桶中,并在创建笔记本时定义路径,例如:
gcloud notebooks instances create nb-1 \
'--vm-image-project=deeplearning-platform-release' \
'--vm-image-family=tf2-latest-cpu' \
'--metadata=post-startup-script=gs://ai-platform-notebooks-tools/install-voila.sh' \
'--location=us-central1-a'
脚本内容:
#!/bin/bash -eu
# Installs Voila in AI Platform Notebook
function install_voila() {
echo 'Installing voila...'
/opt/conda/condabin/conda install -y -c conda-forge ipywidgets ipyvolume bqplot scipy
/opt/conda/condabin/conda install -y -c conda-forge voila
/opt/conda/bin/jupyter lab build
systemctl restart jupyter.service || echo 'Error restarting jupyter.service.'
}
function download_samples() {
echo 'Downloading samples...'
cd /home/jupyter
git clone https://github.com/voila-dashboards/voila
}
function main() {
install_voila || echo 'Error installing voila.'
download_samples || echo 'Error downloading voila samples.'
}
main
堆栈溢出不是代码编写服务。相反,请编辑您的问题,向我们展示您(作为一名员工)具体尝试了什么,并简要说明您在尝试中遇到的困难(预期与实际行为、错误消息等)。这是启动后脚本。这将使用shell脚本作为参数。(即conda安装x)