activate environments in windows

瀏覽次數:0 次
跳到第一則未讀訊息

ryan

未讀,
2016年6月29日 晚上7:06:242016/6/29
收件者:Anaconda - Public
Is it possible to specify and activate an environment at top of a py file? ie:

example #1 

#file contents

activate py35

print("hello")

#end of file

or

example #2 

C:\py27-hello.py

#file contents

activate py27

print "hello"

#end of file

Brian Toby

未讀,
2016年6月29日 晚上8:39:402016/6/29
收件者:anac...@continuum.io
I can’t imagine any way that this could be possible, since the environment must be active before the first line in the Python script starts. I could imagine having a Python script that activates an environment and then launches another Python script in a separate instance of the interpreter. So perhaps one could do something like this: 

   python launch_with_env.py myscript.py

where launch_with_env.py looks at myscript.py for a comment like this: #activate py35, sets up that env with shell calls and then launches myscript.py. 

Brian


--
Anaconda Community Support Group Brought to you by Continuum Analytics
---
You received this message because you are subscribed to the Google Groups "Anaconda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to anaconda+u...@continuum.io.
To post to this group, send email to anac...@continuum.io.
Visit this group at https://groups.google.com/a/continuum.io/group/anaconda/.

Michael Sarahan

未讀,
2016年6月29日 晚上8:53:522016/6/29
收件者:anac...@continuum.io

Check out conda execute: https://github.com/pelson/conda-execute

ryan

未讀,
2016年7月16日 下午2:50:502016/7/16
收件者:Anaconda - Public
Hey Michael,

I'm trying to get the module you recommended to work.  Do you know if it is possible to run python 2.7?  Can't find example and I've tried a few combinations without luck.

Thank you,

Ryan
#!/usr/bin/env python -i

# conda execute
# env:
#  - python <=3
# run_with: py27

print 'hello'

Michael Sarahan

未讀,
2016年7月16日 下午2:59:412016/7/16
收件者:Anaconda - Public
Sorry, I can't offer support on conda execute.  I recommend that you create an issue on their github issue tracker: https://github.com/pelson/conda-execute

ryan

未讀,
2016年7月16日 下午5:46:262016/7/16
收件者:Anaconda - Public
No worries, thought might be able to identify what I was doing wrong.  I already posted on there.  Thanks for help.

Ryan
回覆所有人
回覆作者
轉寄
0 則新訊息