我无法在 git bash 中打开 python 文件
I can't open a python file in git bash
我试图在 git bash 上打开一个 .py
文件,但它不起作用。
我曾尝试按照 运行ning python <filename>
等说明进行操作,但它对我不起作用。
当我运行
python python_basics
我希望它能打开 .py
文件,但它说它无法打开文件 'python_basics':
[Errno 2] No such file or directory
首先检查系统上安装的 python 版本。
通过命令-
python --版本。
如果没有找到
放
$PATH=$PATH:/c/Python27/
修改路径即可解决您的问题
从this question开始,问题很可能是Git Bash本身造成的。
我建议您从不同的终端尝试 运行 您的 Python 文件(Command Prompt
或 PowerShell
如果您使用的是 Windows),使用评论中建议的命令:
python python_basics.py
谢谢你的问题,我是来帮你的,谁会看到这个问题。
如果你的意思是你想打开文件就像点击文件并打开它一样
你可以使用这个 command
Start filename.py
但是如果你想在 gitbash 中打开文件使用这个 command
vim filename.py
如果你想 运行 来自 gitbash 的文件,你可以使用这个 command
python pythonFileName.py
现在如果上面的命令对你不起作用,而你在 windows10 Pro 平台,你应该去
environment variable >> Then system variable >> then choose path >> then Edit >> and put the python path >> restart the terminal and run it again
注意:以上所有我都在 windows10 pro.
中尝试和使用
谢谢,
希望对大家有所帮助,
我试图在 git bash 上打开一个 .py
文件,但它不起作用。
我曾尝试按照 运行ning python <filename>
等说明进行操作,但它对我不起作用。
当我运行
python python_basics
我希望它能打开 .py
文件,但它说它无法打开文件 'python_basics':
[Errno 2] No such file or directory
首先检查系统上安装的 python 版本。 通过命令- python --版本。 如果没有找到 放 $PATH=$PATH:/c/Python27/
修改路径即可解决您的问题
从this question开始,问题很可能是Git Bash本身造成的。
我建议您从不同的终端尝试 运行 您的 Python 文件(Command Prompt
或 PowerShell
如果您使用的是 Windows),使用评论中建议的命令:
python python_basics.py
谢谢你的问题,我是来帮你的,谁会看到这个问题。
如果你的意思是你想打开文件就像点击文件并打开它一样
你可以使用这个 command
Start filename.py
但是如果你想在 gitbash 中打开文件使用这个 command
vim filename.py
如果你想 运行 来自 gitbash 的文件,你可以使用这个 command
python pythonFileName.py
现在如果上面的命令对你不起作用,而你在 windows10 Pro 平台,你应该去
environment variable >> Then system variable >> then choose path >> then Edit >> and put the python path >> restart the terminal and run it again
注意:以上所有我都在 windows10 pro.
中尝试和使用谢谢,
希望对大家有所帮助,