为什么当我 运行 来自不同位置时 python 版本会发生变化?

why does the python version change when i run it from different locations?

当我 运行 来自 ...Anaconda2>python 的 python 编译器时,我得到 python 版本 2.7.11。但是当我 运行 来自 ...Anaconda2/Lib>python 的 python 编译器时,我得到 python 版本 3.5.1.

不确定发生了什么:

C:\Anaconda2>python
Python 2.7.11 |Anaconda 2.5.0 (64-bit)| (default, Jan 29 2016, 14:26:21) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> exit()

C:\Anaconda2>cd lib

C:\Anaconda2\Lib>python
Python 3.5.1 |Anaconda 2.5.0 (64-bit)| (default, Jan 29 2016, 15:01:46) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

当你在cmd中输入python时 Windows 首先在当前目录中搜索python.exe。如果你留在 C:\Anaconda2 它 运行 python2 来自 Anaconda2 安装。当您从 C:\Anaconda2\lib 执行 python 时 Windows 在当前文件夹中找不到它,查看 PATH 环境变量并从另一个 Anaconda 安装中找到另一个 python