anaconda激活环境 python_如何在Python脚本中激活Anaconda环境?

论坛 期权论坛 脚本     
匿名技术用户   2021-1-7 06:06   36   0

I have searched through stack overflow, but no post helped specifically with Anaconda.

I am trying to my own Command line prompt in Python. But to do that, I need to activate my Anaconda environment. I cant find anywhere on the web how to run a basic python script to be able to activate said environment. Does anyone know how to do so?

解决方案

You should be able to use the command line to activate specific environments just by typing:

activate environment-name

You will have to do use source on Linux.

source activate environment-name

EDIT (3/29/2016)

Sorry, I misread the question. You should be able to use the call method in the subprocess module to run the shell command through a Python script.

Edit: A basic example of the subprocess:

subprocess.call(["activate", value])

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP