简体   繁体   English

Notepad ++不适用于Python

[英]Notepad++ won't work with Python

I'm just getting into programming and took the common advice of using a free text editor with python. 我刚刚开始编程,并接受了将免费文本编辑器与python一起使用的常见建议。 I seem to be running into a problem and everything I've tried so far hasn't worked. 我似乎遇到了问题,到目前为止我尝试过的所有方法都无效。

I downloaded Anaconda from this url and whenever I put the location of python.exe into the run bar: C:\\Users\\Home\\Anaconda2\\python.exe all I get is the python console to pop up. 从该URL下载了Anaconda ,每当我将python.exe的位置放到运行栏中时:C:\\ Users \\ Home \\ Anaconda2 \\ python.exe,我得到的只是弹出的python控制台。 I've tried adding: "$(FULL_CURRENT_PATH)" to the end as one user had suggested, but that just opens up the console and closes it immediately after. 我尝试按照一个用户的建议在末尾添加:“ $(FULL_CURRENT_PATH)”,但这只是打开控制台,然后立即关闭它。 Any idea what I'm doing wrong? 知道我在做什么错吗?

First, I usually create a space for all my projects. 首先,我通常为所有项目创建一个空间。 Usually C:\\projects so it's easy to find. 通常是C:\\projects因此很容易找到。 Then I create a folder for specific work. 然后,我创建一个用于特定工作的文件夹。 I'd do C:\\projects\\learningPython . 我会做C:\\projects\\learningPython

Now, create a new file and save it to C:\\projects\\learningPython\\hello-world.py 现在,创建一个新文件并将其保存到C:\\projects\\learningPython\\hello-world.py

In the file put this line 在文件中放入这一行

print('Hello World!')

Then click save. 然后点击保存。

Now open a command prompt (enter cmd in the run bar) 现在打开命令提示符(在运行栏中输入cmd

now enter this in the command prompt: 现在在命令提示符下输入:

python C:\projects\learningPython\hello-world.py

Hopefully this will work for you. 希望这对您有用。 Let me know if you do not see 'Hello World' appear on the command prompt. 如果您没有在命令提示符下看到“ Hello World”,请告诉我。

After you followed nlloyd instructions and you are assured that your setup works and you can use Python from the commandline, I would use the nppexec Plugin to integrate Python (and other external tools) with notepad++ . 在遵循nlloyd的说明并确定设置可以正常使用并且可以从命令行使用Python之后,我将使用nppexec插件将Python(和其他外部工具)与notepad ++集成在一起。 (You can get it from Notepad++ PluginCentral or directly via the Plugins -> PluginManager.) There I would create a nppexec script: with the following lines (use Plugins -> NppExec -> Execute... ): (您可以从Notepad ++ PluginCentral或直接通过Plugins- > PluginManager来获得它。)在那里,我将创建一个nppexec脚本:使用以下几行(使用Plugins-> NppExec-> Execute ...):

npp_save
C:\Tools\Python\Python.exe $(FULL_CURRENT_PATH)
  • change C:\\Tools\\Python\\Python.exe to whereever you have installed python C:\\Tools\\Python\\Python.exe为已安装python的任何位置
  • save this nppexec script 保存此nppexec脚本
  • use the commands Execute... and Direct execute previous from Plugins -> Nppexec menu to select the nppexec script (if you have several) and repeatedly use the same nppexec script 从插件-> Nppexec菜单中使用命令Execute...Direct execute previous命令来选择nppexec脚本(如果有多个)并重复使用相同的nppexec脚本

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

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