是否可以在Google合作实验室中设置环境变量? [英] Is it possible to set environment variables in Google's Colaboratory?
本文介绍了是否可以在Google合作实验室中设置环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在Google的协作平台中运行一些Python脚本.现在,我需要设置系统的一些环境变量.如下图所示:
I am running some Python scripts in Google's Colaboratory platform. Now, I need to set some environment variables of the system. Like the following shows:
!export PATH=drive/app/tf-models-fork/research;drive/app/tf-models-fork/research/object_detection;drive/app/tf-models-fork/research/slim;$PATH
我试图将位置添加到变量PATH.但是,出现以下错误:
I tried to add the location to the variable PATH. However, I am getting the following errors:
/bin/sh: 1: drive/app/tf-models-fork/research/object_detection: Permission denied
/bin/sh: 1: drive/app/tf-models-fork/research/slim: Permission denied
/bin/sh: 1: drive/app/tf-models-fork/research: Permission denied
在此平台上是否可以设置环境变量?
Is there any way to set the environment variables in this platform?
推荐答案
我通常将PATH
设置为os.environ
,如下所示:
I normally set the PATH
with os.environ
, like this:
import os
os.environ['PATH'] += ":/usr/local/go/bin"
这篇关于是否可以在Google合作实验室中设置环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文