python - 通过 Cygwin 运行 Python 脚本的问题

标签 python windows cygwin

我正在尝试通过 Windows 中的 Cygwin 运行我的 Python 脚本。运行 Python 时出现以下错误。问题是当通过 Cygwin 运行 Python 时,它然后通过 Python 的 Windows 实例运行命令,即 C:\Python32\python.exe 然后找不到 py我正在使用 Cygwin 方式链接到的文件。

$ /cygdrive/c/Python32/python /cygdrive/c/elf/GIT/src/sfgenctl.py
C:\Python32\python.exe: can't open file '/cygdrive/c/elf/GIT/src/sfgenctl.py':
[Errno 2] No such file or directory

有解决办法吗?

谢谢

最佳答案

在将其传递给 python.exe 之前,使用 cygpath 将其转换为 Windows 路径:

/cygdrive/c/Python32/python "`cygpath -w /cygdrive/c/elf/GIT/src/sfgenctl.py`"

关于python - 通过 Cygwin 运行 Python 脚本的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12189016/

相关文章:

git - *.bat text eol=crlf 但 git 仍然更改行结尾

python - 使用 dateutil 解析日期时出现问题

python - Flask 应用程序回溯未显示在服务器日志中

python - 如何使用Python中的Tkinter,使用几个选定颜色的迭代来更改Python中的圆圈颜色,这些颜色随着每次按下按钮而变化?

c# - 标题栏不可点击 Form.TransparencyKey = White

python - Cygwin 上的 os.name 是什么?

python - 从单行 pandas DataFrame 中提取值

python - 尝试安装 WebRTCVAD 模块时出现编译错误

java - Wildfly 8 无法在 Windows 7 32 位中启动

git 错误 : ssh: Could not resolve hostname?