Git Bash 切换版本 python
Git Bash switching version in python
我已经在我的 C: 驱动器中安装了 Python27。我有一个用 Python2.7.x 编写的代码,当我在 Git Bash 命令行中键入语句时 -
python --version
它给了我
3.8.1
如何运行 Python2.7.x 脚本 first.py 位于以下目录
C:/Python27/m1/m1/first.py
您可以通过
查看您安装的python版本
py -0
您可以使用 python2
来执行您的脚本
winpty py -2 <your_file>
如果你python 3
winpty py -3 <your_file>
如果您的机器上安装了多个 python 3 (3.8, 3.9),并且您想测试 python 3.9
中的文件
winpty py -3.9 <your_file>
您可以通过向 .bashrc
文件添加别名来为 winpty py
添加别名命令
alias py='winpty py'
现在不用输入 winpty py
,而是使用 py
我已经在我的 C: 驱动器中安装了 Python27。我有一个用 Python2.7.x 编写的代码,当我在 Git Bash 命令行中键入语句时 -
python --version
它给了我
3.8.1
如何运行 Python2.7.x 脚本 first.py 位于以下目录
C:/Python27/m1/m1/first.py
您可以通过
查看您安装的python版本py -0
您可以使用 python2
来执行您的脚本winpty py -2 <your_file>
如果你python 3
winpty py -3 <your_file>
如果您的机器上安装了多个 python 3 (3.8, 3.9),并且您想测试 python 3.9
中的文件winpty py -3.9 <your_file>
您可以通过向 .bashrc
文件添加别名来为 winpty py
添加别名命令
alias py='winpty py'
现在不用输入 winpty py
,而是使用 py