繁体   English   中英

每当我尝试在命令行中运行python脚本时,“无法在'__main__'模块中找到”错误

[英]“Can't find '__main__' module in” error whenever I try to run a python script in the command line

这是我的批处理文件代码:

@py C:\Users\Asus\Google Drive\Lifestyle\Technicals\Programming\Python\Python Scripts\Test.py %*
@pause

另外,当我在命令行中尝试以下代码行时,也会出现相同的错误:

py.exe C:\Users\Asus\Google Drive\Lifestyle\Technicals\Programming\Python\Python Scripts\Test.py

我的Test.py文件具有:

print('Hello')

错误信息: 在此处输入图片说明

你可以尝试做吗

python "C:\Users\Asus\Google Drive\Lifestyle\Technicals\Programming\Python\Python Scripts\Test.py"

命令行不喜欢“”(空格)字符。 从而破坏了您的命令。

您需要将cd directory放在正确的目录中,或者执行用双引号引起来的命令

暂无
暂无

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

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