简体   繁体   English

在anaconda虚拟环境中使用activate和直接调用python的区别

[英]Difference of using activate & directly call python in anaconda virtual environment

I first install anaconda2, then install anaconda3 in envs. 我先安装anaconda2,然后在envs中安装anaconda3。

E:\>conda info -e

# conda environments:
#
base                  *  D:\Anaconda2
py3                      D:\Anaconda2\envs\py3

Then I want to execute a python3 script test.py . 然后我要执行一个python3脚本test.py There maybe 2 methods to do that: 可能有两种方法可以做到这一点:

1. 1。

E:\>activate py3

(py3) E:\>python test.py
hello world

(py3) E:\>deactivate

2. 2。

E:\>D:\Anaconda2\envs\py3\python test.py
hello world

What's the difference? 有什么不同? What's the suggested way or any potential issue if I use one of them? 如果我使用其中一种,建议的方法是什么或存在任何潜在的问题?

Both are same. 两者都一样。 Activate helps you with not having to type in the full path to python interpreter everytime 激活可以帮助您不必每次都输入python解释器的完整路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM