【问题标题】:How to change python version in windows git bash?如何在 Windows git bash 中更改 python 版本?
【发布时间】:2016-01-03 03:15:06
【问题描述】:

我已经在 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?

【问题讨论】:

    标签: python git-bash


    【解决方案1】:

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

    例子:

    PATH=$PATH:/c/Python27/
    

    【讨论】:

      【解决方案2】:

      按照以下步骤操作:

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

      希望它对你有用。

      【讨论】:

        猜你喜欢
        • 2021-06-05
        • 2014-01-19
        • 2012-07-28
        • 2011-12-10
        • 2019-02-12
        • 2016-11-28
        • 2013-12-08
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多