繁体   English   中英

如何在 windows git bash 中更改 python 版本?

[英]How to change python version in windows git bash?

我已经在 Windows 上安装了 python 3.5 和 python 2.7。 我在 PATH 变量中添加了 python 2.7 的路径。 当我在 Windows cmd 中键入“python --version”时,它会打印 2.7。 但是当我在 git Bush 中输入 'python --version' 时,它会打印 3.5。 如何将 windows git bash 中的 python 版本更改为 2.7?

按着这些次序:

  1. 打开 Git bash, cd ~
  2. 根据您最喜欢的编辑器touchcodevim (在我的情况下)键入code .bashrc
  3. 将行alias python='winpty c:/Python27/python.exe'到打开的 .bashrc
  4. 保存并关闭。
  5. 再次在 git bash 上尝试python --version

希望它对你有用。

尝试将 git bash 中的路径设置为正确的文件夹。

例子:

PATH=$PATH:/c/Python27/

暂无
暂无

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

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