[英]How can I run a python script on windows?
Can anyone please tell me an IDE for running python programs? 谁能告诉我运行Python程序的IDE? Is it possible to run the program through command line?
是否可以通过命令行运行程序?
Take a look at ActiveState's ActivePython . 看一下ActiveState的ActivePython 。 It's quite a nice implementation of Python on Windows.
这是Windows上Python的一个很好的实现。 Another way is using Cygwin's Python port .
另一种方法是使用Cygwin的Python port 。 These two are Python implementations .
这两个是Python 实现 。 I don't use an IDE, I write my Python code in Notepad++ .
我不使用IDE,而是用Notepad ++编写Python代码。
To run a python program after saving it to C:\\Users\\vaibhav\\Code\\myscript.py
: 在将python程序保存到
C:\\Users\\vaibhav\\Code\\myscript.py
:
ActivePython: If I remember right, ActiveState updates the path correctly. ActivePython:如果我没记错的话,ActiveState会正确更新路径。 So it should be as simple as:
因此它应该很简单:
dir Users\\vaibhav\\Code
dir Users\\vaibhav\\Code
python myscript.py
and you're done python myscript.py
就可以了 Cygwin: After installing Cygwin, you have a full-featured bash terminal on your Windows machine. Cygwin:安装Cygwin后,您在Windows机器上拥有功能齐全的bash终端。
cd /cygdrive/c/Users/vaibhav/Code
cd /cygdrive/c/Users/vaibhav/Code
python myscript.py
python myscript.py
IDE for running scripts? IDE是否运行脚本? You can have any IDE you like, but if you need only to run python scripts you go like this:
您可以使用任何喜欢的IDE,但是如果只需要运行python脚本,则可以这样进行:
python.exe pythonScript.py python.exe pythonScript.py
I like the EasyEclipse for python distribution. 我喜欢EasyEclipse用于python发行版。 You'd need to have python and java installed of course.
当然,您需要安装python和java。
PyDev and Komodo Edit are 2 nice Python IDE on Windows. PyDev和Komodo Edit是Windows上两个不错的Python IDE。
I also like the SciTE text editor very much. 我也非常喜欢SciTE文本编辑器。
These 3 solutions make possible to run Python scripts 这3种解决方案可以运行Python脚本
I tried to run a Python script with multiprocessing on windows. 我试图在Windows上运行具有多处理功能的Python脚本。 see this tutorial
看到这个教程
It does not work on Windows, but on raspian it went very well. 它在Windows上不起作用,但是在raspian上运行得很好。 Thus I knew that it was a Windows problem.
因此,我知道这是Windows问题。 I installed cygwin and followed this tutorial Installing Python inside Cygwin .
我安装了cygwin,并遵循了本教程在Cygwin中安装Python 。
After that I additionally installed numpy with the command easy_install numpy
and now i can run python scripts with multiprocessing on windows (from cygwin). 之后,我还使用了
easy_install numpy
命令安装了easy_install numpy
,现在我可以在Windows上运行来自cygwin的带有多处理功能的python脚本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.