简体   繁体   English

为什么我不能通过我的 cmd 成功运行这个 python 文件? [等候接听]

[英]Why can't I successfully run this python file through my cmd? [on hold]

So I have a.py file that I want to run through my cmd.所以我有一个 .py 文件,我想通过我的 cmd 运行它。 It gives me an error shown in the first picture.它给了我第一张图片中显示的错误。 I dont know how I might fix this problem as the code works in my jupyter notebook fine, so there is no error popping up.我不知道如何解决这个问题,因为代码在我的 jupyter 笔记本中运行良好,所以没有弹出错误。 Thank you.谢谢你。

Error in CMD CMD 中的错误

Code 1代码 1

Code 2代码 2

Code 3代码 3

Code 4代码 4

New photo showing output显示 output 的新照片

You need to execute your python script using python, If you have python installed and your path variables are set, try python yourscriptname.py or py yourscriptname.py .您需要使用 python 执行 python 脚本,如果您安装了 python 并且设置了路径变量,请尝试python yourscriptname.pypy yourscriptname.py yourscript yourscript.pyBA

Edit: Try to avoid spaces and special characters in your file paths.编辑:尽量避免文件路径中的空格和特殊字符。

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

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