简体   繁体   English

在记事本++中运行python脚本不起作用,其他帖子也不起作用

[英]Running a python script in notepad ++ doesn't work and other posts doesn't work

Recently, (Half an hour ago) I downloaded Notepad++ to code in rather than IDLE. 最近,(半小时前)我下载了Notepad ++而不是IDLE进行编码。

Just to see if everything works out I created this simple program to test 只是看是否一切正常,我创建了一个简单的程序来测试

def test():
    print("hello")

test()

I ran it, and then a window opened up and closed instantly. 我运行它,然后一个窗口打开并立即关闭。

Assuming the answer to the problem I had was located here: How to Execute a Python File in Notepad ++? 假定我的问题的答案位于此处: 如何在记事本++中执行Python文件? I followed the instructions, I tried it and it didn't work. 我按照指示进行了尝试,但没有成功。 Then I copied the file path with shift-RBM instead for what was on the page and still comes up with an error message as before: 然后,我用shift-RBM复制了文件路径,而不是复制页面上的内容,但仍然像以前一样出现错误消息:

The system cannot find the file specified.
An attempt was made to execute the below command.
-------------------------------------------------
Command: C:\Users\----\Desktop\Python
Arguments: 3.5\Python 3.5 (32-bit).Ink
"C:\Users\----\Desktop\test.py" -i
Error Code: 2
-------------------------------------------------

After this I came here and asked this question. 之后,我来到这里问这个问题。 Sorry if the answer is said elsewhere or is obvious. 如果答案在其他地方说的很明显,很抱歉。

Looks like you have space in some folder names. 看起来某些文件夹名称中有空格。

To fix this you need to use " before and after the path to python. 要解决此问题,您需要在python路径之前和之后使用“”

Example: 例:

"C:\Users\----\Desktop\Python 3.5\Python 3.5 (32-bit).Ink" "C:\Users\----\Desktop\test.py" -i

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

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