标签归档:ide

是否有类似RStudio for Python的东西?[关闭]

问题:是否有类似RStudio for Python的东西?[关闭]

在RStudio中,可以在代码编辑窗口中运行部分代码,结果将显示在控制台中。

您还可以做一些很酷的事情,例如选择是运行光标之前的所有内容,还是光标之后的所有内容,还是只是选择的部分,等等。所有这些东西都有热键。

这就像Python交互式外壳之上的一个步骤-您可以在其中使用readline返回上一行,但是它没有任何关于功能是什么,代码段等的“概念”。

是否有类似Python的工具?或者,您是否有某种类似的解决方法,例如在vim中使用?

In RStudio, you can run parts of code in the code editing window, and the results appear in the console.

You can also do cool stuff like selecting whether you want everything up to the cursor to run, or everything after the cursor, or just the part that you selected, and so on. And there are hot keys for all that stuff.

It’s like a step above the interactive shell in Python — there you can use readline to go back to previous individual lines, but it doesn’t have any “concept” of what a function is, a section of code, etc.

Is there a tool like that for Python? Or, do you have some sort of similar workaround that you use, say, in vim?


回答 0

IPython Notebooks很棒。我最近发现了另一个基于浏览器的更新工具:Rodeo。我的印象是,它似乎可以更好地支持类似RStudio的工作流程。

IPython Notebooks are awesome. Here’s another, newer browser-based tool I’ve recently discovered: Rodeo. My impression is that it seems to better support an RStudio-like workflow.


回答 1

Jupyter Notebook(以前称为IPython Notebook)是一个非常酷的项目,用于使用Python(和其他语言,包括R)进行交互式数据操作。基本上,它允许您在一个界面中交互地编码和记录正在执行的操作,然后将其另存为:

  • 笔记本(.ipynb
  • 脚本(仅包含源代码的.py文件)
  • 静态html(因此也是pdf)

您甚至可以使用nbviewer服务与他人在线共享您的笔记本,该服务使人们可以出版整本书。此外,GitHub 呈现您的.ipynb文件。您可以将Jupyter笔记本作为可复制的研究文章发表在Authorea上。要由多个用户进行协作编辑,请查看基于Jupyter构建的Google Colab。

Jupyter Notebook的默认版本在本地启动Web应用程序(或将其部署到服务器),然后从浏览器中使用它。正如Ryan在回答中提到的那样,Rodeo是一个与基于Jupyter内核构建的RStudio更相似的界面。

JupyterLab是UI的较新版本,它为您编辑笔记本,控制交互式小部件甚至在终端仿真器中运行命令提供了更大的灵活性。

还有一个用于IPythonQt控制台,这是一个带有嵌入式绘图的类似项目,它是一个桌面应用程序。

Jupyter是一个普通的Python软件包,可以使用安装pip install jupyter。但是,要使所有科学图书馆都在您的计算机上运行,​​尝试使用官方的Jupyter Docker容器可能会更容易。例如,假设您的笔记本在〜/ code / jupyter中,则可以按以下方式运行容器:

docker run -it --rm -p 8888:8888 -v ~/code/jupyter:/home/jovyan/work jupyter/datascience-notebook

Jupyter Notebook (previously known as IPython notebook) is a really cool project for interactive data manipulation in Python (and other languages, including R). It basically allows you to interactively code and document what you’re doing in one interface and later on save it as a:

  • notebook (.ipynb)
  • script (a .py file including only the source code)
  • static html (and therefore pdf as well)

You can even share your notebooks online with others using the nbviewer service, where people publish whole books. Furthermore, GitHub renders your .ipynb files. You can publish your Jupyter Notebooks as reproducible research articles on Authorea. For collaborative editing by multiple users, check out Google Colab built on top of Jupyter.

The default Jupyter Notebook version starts a web application locally (or you deploy it to a server) and you use it from your browser. As Ryan also mentioned in his answer, Rodeo is an interface more similar to RStudio built on top of the Jupyter kernel.

JupyterLab is a newer take on the UI allowing for more flexibility in how you edit your notebooks, control interactive widgets and even run commands in terminal emulators.

There’s also a Qt console for IPython, a similar project with inline plots, which is a desktop application.

Jupyter is a normal Python package and can be installed using pip install jupyter. To get all the scientific libraries running on your computer, however, it might be easier to try the official Jupyter Docker containers. For example, assuming your notebooks are in ~/code/jupyter, you can run the container as:

docker run -it --rm -p 8888:8888 -v ~/code/jupyter:/home/jovyan/work jupyter/datascience-notebook

回答 2

spyder或安装python(x,y)。这太棒了。

如果您不熟悉Python,则可以安装免费的Anaconda发行版(http://continuum.io/downloads.html),它将为您安装Spyder以及Python 2.7和IPython。Spyder与RStudio非常相似。

spyder or install python(x,y). it is great.

If you are new to Python, you can install the free Anaconda distribution (http://continuum.io/downloads.html), which will install Spyder for you, as well as Python 2.7 and IPython. Spyder is very similar to RStudio.


回答 3

如果您正在寻找RStudio for Python之类的东西,请查看Yhat的Rodeo

牛仔竞技有:

  • 文本编辑器(在后台使用Atom)
  • Vim / Emacs模式
  • IPython控制台
  • 自动完成
  • 文档字符串
  • 能够查看图表,数据框,变量

Check out Rodeo from Yhat if you’re looking for something like RStudio for Python.

Rodeo has:

  • text editor (uses Atom under the hood)
  • Vim / Emacs mode
  • an IPython console
  • autocomplete
  • docstrings
  • ability to see plots, dataframes, variables

回答 4

您可能需要研究JupyterLab(下一代Jupyter Notbooks):https : //github.com/jupyter/jupyterlab

JupyterLab旨在在Web上创建更类似于桌面的体验。

更新:截至2018年3月,JupyterLab处于beta版。“该Beta版本适合一般使用。对于JupyterLab扩展开发人员而言,扩展API将会继续发展,直到1.0版本。最终,JupyterLab将在JupyterLab达到1.0后替换经典的Jupyter Notebook。

要将Jupyter Lab作为桌面应用程序运行,请参阅 christopherroach.com/articles/jupyterlab-desktop-app(感谢PatrickT)。

快速预览:

您可以在监视系统的终端上方的图形控制台旁边放置一个笔记本,同时将文件管理器保持在左侧:

有关更多详细信息,请参见:https : //blog.jupyter.org/2016/07/14/jupyter-lab-alpha/以及此处:http : //www.techatbloomberg.com/blog/inside-the-collaboration-that-内置了开源jupyterlab-project /

You might want to look into JupyterLab (the next generation of Jupyter Notbooks): https://github.com/jupyter/jupyterlab.

JupyterLab aims to create a more desktop-like experience on the Web.

Update: As of March 2018 JupyterLab is in beta. “The beta releases are suitable for general usage. For JupyterLab extension developers, the extension APIs will continue to evolve until the 1.0 release. Eventually, JupyterLab will replace the classic Jupyter Notebook after JupyterLab reaches 1.0.

To run Jupyter Lab as a Desktop Application, see christopherroach.com/articles/jupyterlab-desktop-app (Thanks to PatrickT).

Here’s a quick preview:

You can arrange a notebook next to a graphical console atop a terminal that is monitoring the system, while keeping the file manager on the left:

For more details see: https://blog.jupyter.org/2016/07/14/jupyter-lab-alpha/ and here: http://www.techatbloomberg.com/blog/inside-the-collaboration-that-built-the-open-source-jupyterlab-project/.


回答 5

Pycharm是一个非常不错的IDE。从目前为止我所看到的,它与Rstudio最相似。另一个不错的功能是,它允许您以类似于Rstudio的方式安装新的Python库(否则可能是一场噩梦)。现在有一个免费的“社区”版。

Pycharm is a really decent IDE. From what I have seen so far it is the most similar to Rstudio. Another nice piece is that it allows you to install new Python libraries in a fashion similar to Rstudio (which otherwise can be a nightmare). There is now a free ‘community’ edition.


回答 6

我认为值得一提的是RStudio v1.1.359 Preview已发布。它具有可用于Python的终端功能。

在此处下载

文档在这里

I think it is worth while to mention that RStudio v1.1.359 Preview is released. It has terminal feature that can be used for Python.

Download is available here

Documentation is available here


回答 7

间谍是您所需要的! https://code.google.com/p/spyderlib/
Spyder(以前称为Pydee)是功能强大的Python语言交互式开发环境,具有高级编辑,交互式测试,调试和自省功能

spyder is you need! https://code.google.com/p/spyderlib/
Spyder (previously known as Pydee) is a powerful interactive development environment for the Python language with advanced editing, interactive testing, debugging and introspection features


回答 8

对于更好的Python交互式外壳,请查看DreamPie。它不是真正的IDE(就像RStudio一样?)

For a nicer interactive shell for Python, have a look at DreamPie. It’s not really an IDE though (as RStudio seems to be?)


回答 9

Wing IDE,以及其他Python IDE(例如PyCharm和PyDev)也具有类似的功能。在Wing中,您可以在集成的Python Shell中选择并执行代码,或者如果要调试某些内容,则可以与Shell中暂停的调试程序进行交互(称为“调试探针”)。万一您正在使用matplotlib,它还提供了特殊支持,因此您可以交互使用绘图。

Wing IDE, and probably also other Python IDEs like PyCharm and PyDev have features like this. In Wing you can either select and execute code in the integrated Python Shell or if you’re debugging something you can interact with the paused debug program in a shell (called the Debug Probe). There is also special support for matplotlib, in case you’re using that, so that you can work with plots interactively.


在Mac OS X上,适用于Python的IDE是什么?[关闭]

问题:在Mac OS X上,适用于Python的IDE是什么?[关闭]

我将开始一项新工作,其中的编码实践主要围绕TDD和重构进行,并且其主要开发语言是Python。我来自Java世界,长期以来一直是Eclipse的自信用户。不使用Java时,我使用emacs。

我正在寻找一个适用于Python的IDE,该IDE将提供与Eclipse一起使用的许多功能,不仅用于重构,而且还涉及代码完成,项目管理,SCM集成(当前为CVS,但可能这些天之一切换到git)等。

我应该使用哪种IDE?

I’m about to start a new job where the coding practices are heavily centered around TDD and refactoring, and whose primary development language is Python. I come from the Java world, and have been a confident user of Eclipse for a good, long time. When not working in Java, I use emacs.

I’m looking for an IDE for Python that will give me a lot of the capabilities I’ve grown used to with Eclipse, not only for refactoring but in terms of code completion, project management, SCM integration (currently CVS, but likely to switch to git one of these days) et al.

What IDE should I use?


回答 0

尝试了许多不同的方法(Kate,Eclipse,Scite,Vim,Komodo):每个函数都有一些故障,要么功能有限,要么反应缓慢且反应迟钝。多年后的最终选择:Emacs + ropemas + flymake。绳索项目文件打开对话框非常快捷。绳索重构和代码辅助功能非常有用。Flymake显示语法错误。Emacs是最可配置的编辑器。我对此配置感到非常满意。配置的Python相关部分位于此处:public.halogen-dg.com浏览器/alex-emacs-settings/configs/cfg_python.el

Have tried many different (Kate, Eclipse, Scite, Vim, Komodo): each one have some glitches, either limited functions, or slow and unresponsive. Final choice after many years: Emacs + ropemacs + flymake. Rope project file open dialog is extremely quick. Rope refactoring and code assist functions are super helpful. Flymake shows syntax mistakes. Emacs is the most configurable editor. I am very happy with this config. Python related part of config is here: public.halogen-dg.com browser/alex-emacs-settings/configs/cfg_python.el


回答 1

我的2便士,请查看PyCharm http://www.jetbrains.com/pycharm/

(也是多平台的)

My 2 pennies, check out PyCharm http://www.jetbrains.com/pycharm/

(also multi-platform)


回答 2

我将TextMate用于我的所有Python编程需求。它本身并不是一个IDE,但是它可以做很多IDE可以做的事情(没有IDE的全部麻烦)。它具有语法突出显示,代码折叠,通过使用其他捆绑软件与各种SCM集成(我知道它支持SVN,Git,Mercurial,Darcs以及其他一些支持)。它也具有相当的可扩展性和可定制性(再次通过使用包)。它还具有项目的基本概念。但是,它不发光的一个地方是代码完成。一些捆绑软件对代码完成的支持有限,但是通常不像大多数特定语言的IDE那样令人惊奇。但是,鉴于TextMate的出色表现,我不知道要牺牲多少。TextMate绝对使我的工作效率更高。

I use TextMate for all my Python programming needs. It’s not an IDE per se, but it does a lot of stuff that an IDE does (without all the cruft of an IDE). It has syntax highlighting, code folding, integration with various SCMs through the use of additional bundles (I know it supports SVN, Git, Mercurial, Darcs, and probably a few others). It’s also quite extensible and customizable (again, through the use of bundles). It also has a basic concept of projects. One place where it doesn’t shine, though, is in code completion; some bundles have limited support for code completion, but it’s generally not as amazing as that of most language-specific IDEs. Given how awesome TextMate is, though, I don’t know sacrificing that. TextMate’s definitely made me much more productive.


回答 3

正如其他人所提到的,用于Eclipse的Pydev很好。

Netbeans有一个Beta版Python插件,边缘有些粗糙,但可能会变得很酷。

此外,有很多针对Mac的以编程为中心的文本编辑器,它们可能满足或不满足您的需求。

  • Textmate-花钱,人们喜欢这个程序,但是我还没有足够用它来了解所有的大惊小怪。
  • Jedit-基于Java的文本编辑器,具有一些不错的功能,但是启动时间并不好(由于Java)。
  • CarbonEmacs-体面的Emacs端口。
  • AquaEmacs-更好的Emacs端口。
  • TextWrangler -Lite,BBEdit的免费版本(如啤酒)。
  • BBEdit-老兵。Textmate之前的事实编辑偷走了风头。昂贵。
  • Smultron-非常好的编辑器,UI类似于Textmate。
  • 空闲 -Python自己的小编辑器,具有一些不错的功能,但也存在一些主要问题。我个人觉得使用起来太不稳定了。
  • Sublime TextSublime文本) -这是一个非常好的文本编辑器,具有令人惊讶的良好Python支持。
  • Pycharm-用于Python的IDE上的另一个完整版本。

Pydev for Eclipse, as others have mentioned, is good.

Netbeans has a beta Python plugin that is a little rough around the edges, but could turn into something really cool.

Additionally there is a long list of programming centric text editors for the mac, that may or may not fit your needs.

  • Textmate – costs money, people love this program, but I haven’t used it enough to see what all the fuss is about.
  • Jedit – Java based text editor, has some nice features, but the startup time isn’t great (due to Java).
  • CarbonEmacs – Decent Emacs port.
  • AquaEmacs – Better Emacs port.
  • TextWrangler – Lite, free (as in beer) verision of BBEdit.
  • BBEdit – The old guard. The defacto editor before Textmate stole its limelight. Expensive.
  • Smultron – Very nice editor, the UI is similar to Textmate.
  • Idle – Python’s own little editor, has some nice features, but also some major problems. I’ve personally found it too unstable for my usage.
  • Sublime Text – This is really sweet text editor that has some surprisingly good Python support.
  • Pycharm – Another solid full on IDE for Python.

回答 4

带有Pydev的 Eclipse 在任何平台上最适合我。

Eclipse with Pydev works best for me on any platform.


回答 5

我真的很喜欢使用PyCharm。http://www.jetbrains.com/pycharm/


回答 6

我通常将komodo editaquamacsropemas 一起使用。尽管我应该警告您,但是如果您来自Java或C#背景,IDE功能将不再是您惯用的功能。我个人发现,功能强大的IDE会比他们提供的帮助更多。

更新:我还应该指出,如果您有钱,Komodo IDE是值得的。这是Komodo Edit的付费版本。

I usually use either komodo edit or aquamacs with ropemacs. Although I should warn you, IDE features won’t be what you’re used to if you’re coming from a Java or C# background. I personally find that powerful IDEs get in my way more than they help.

UPDATE: I should also point out that if you have the money Komodo IDE is worth it. It’s the paid version of Komodo Edit.


回答 7

macvim + pyflakes.vim

macvim + pyflakes.vim


回答 8

我喜欢Spyder,它具有许多工具,例如性能分析,智能缩进帮助器和良好的自动完成支持

https://code.google.com/p/spyderlib/

I like Spyder, it has many tools, such as profiling, intelligent indentation helper and a good autocompletion support

https://code.google.com/p/spyderlib/


回答 9

如果您的IDE有预算,则应尝试Wingware Professional,请参阅wingware.com。

If you have a budget for your IDE, you should give Wingware Professional a try, see wingware.com .


回答 10

我用过WingIDE并感到非常高兴。Intellisense相当不错,其他一些东西虽然有些古怪,但总的来说这是一个非常有效的工具

I’ve used WingIDE and have been very happy. Intellisense is pretty good, some other things are a bit wacky but overall it’s a very productive tool


回答 11

如果您正在寻找一个交互式环境并且不需要编写模块代码,我建议使用IPython。尽管这是在考虑科学家/统计学家的前提下开发的,但是它在没有安装任何科学软件包的情况下也可以正常运行。这些功能强大,具有代码完成,集成的帮助,集成的调试等功能,并且可作为具有Markdown和MathJax集成的笔记本使用。到目前为止,对于那些需要强大功能而又不希望将MB的GUI加载到RAM的用户来说,这是最佳选择-由于它是基于浏览器的,因此可在您始终加载的 chrome / safari实例中使用。;-)

If you are looking for an interactive environment and not needing to code modules, I would suggest IPython. Though this is developed with scientists/statisticians in mind, it will run just as well without any of the scientific packages installed. The features are powerful, with code completion, integrated help, integrated debugging, etc., and it functions as a notebook with Markdown and MathJax integration. By far the best choice for those that need powerful features without wishing to load megabytes of GUI into RAM–since it is browser based, it is used in your always loaded chrome/safari instance. ;-)


回答 12

Eclipse PyDev插件。

http://pydev.sourceforge.net/


回答 13

因为您熟悉Eclipse,所以您可能对Pydev感兴趣

since you are familiar with Eclipse maybe you are interested in Pydev


回答 14

Netbeans对Python的支持非常好,并且提供了您正在寻找的大多数功能。

Python support on netbeans is surprisingly good, and comes with most of the features you’re looking for.


回答 15

TextMate或Panic的尾声。如果您需要功能完善的厨房水槽IDE,则NetBeans可以很好地工作。

TextMate or Panic’s Coda. NetBeans works very well, if you want a full-blown kitchen sink IDE.


回答 16

我已经在Google上搜索了类似这样的应用程序一段时间,但我发现只有界面笨拙的选项。

然后,我打开了Mac App Store,找到了CodeRunner。非常漂亮和干净的界面。支持多种语言,如Python,Lua,Perl,Ruby,Javascript等。价格为10美元,但值得!

I’ve searched on Google for an app like this for a while, and I’ve found only options with heavy and ugly interfaces.

Then I opened Mac App Store and found CodeRunner. Very nice and clean interface. Support many languages like Python, Lua, Perl, Ruby, Javascript, etc. The price is U$10, but it’s worth it!


回答 17

“ …的哪个编辑器/ IDE?” 是开始“我的狗比你的狗还漂亮”的长期方法。最棒的 如今,大多数vim向上的编辑器都可以使用,有很多不错的选择,甚至以C或Java工具开头的IDE都可以与Python和其他动态语言很好地兼容。

就是说,在尝试了许多IDE(Eclipse,NetBeans,XCode,Komodo,PyCharm等)之后,我成为ActiveState的Komodo IDE的粉丝。我主要在Mac OS X上使用它,尽管我在Windows上也使用了多年。一个许可证可将您带到任何平台。

Komodo与流行的ActiveState语言本身很好地集成在一起(尤其是Windows),与神话般的(和Pythonic的)Mercurial变更管理系统(以及其他)兼容,并且具有出色的处理核心任务的能力,例如代码编辑,语法着色,代码完成,实时语法检查和可视调试。在预集成的重构和代码检查工具(例如绳索,pylint)方面,它有点弱,但是它是可扩展的,并且具有集成外部工具和定制工具的良好功能。

我喜欢Komodo的某些方面超出了write-run-debug循环。自从动态语言成为趋势之前,ActiveState长期以来就一直为开发社区提供支持(例如,使用免费语言构建,软件包存储库,配方站点等)。基本的Komodo Edit编辑器是免费和开源的,是Mozilla Firefox技术的扩展。科莫多语是多国语言。我永远不会只做Python,Perl或其他任何事情。Komodo使用核心语言(Python,Perl,Ruby,PHP,JavaScript)以及支持语言(XML,XSLT,SQL,X / HTML,CSS),非动态语言(Java,C等)和帮助器( Makefile,INI和配置文件,shell脚本,自定义小语言等),其他人也可以做到这一点,但Komodo将它们全部放在一个地方,随时可以使用。它是动态语言的瑞士军刀。

Komodo IDE绝不是完美的,而编辑器/ IDE是YMMV的最终选择。但是我经常很高兴使用它,每年我都很高兴地重新获得支持订阅。的确,我只记得!这个月即将到来。信用卡:出。我与ActiveState没有任何商业联系,只是一个满意的客户。

“Which editor/IDE for …?” is a longstanding way to start a “My dog is too prettier than yours!” slapfest. Nowadays most editors from vim upwards can be used, there are multiple good alternatives, and even IDEs that started as C or Java tools work pretty well with Python and other dynamic languages.

That said, having tried a bunch of IDEs (Eclipse, NetBeans, XCode, Komodo, PyCharm, …), I am a fan of ActiveState’s Komodo IDE. I use it on Mac OS X primarily, though I’ve used it for years on Windows as well. The one license follows you to any platform.

Komodo is well-integrated with popular ActiveState builds of the languages themselves (esp. for Windows), works well with the fabulous (and Pythonic) Mercurial change management system (among others), and has good-to-excellent abilities for core tasks like code editing, syntax coloring, code completion, real-time syntax checking, and visual debugging. It is a little weak when it comes to pre-integrated refactoring and code-check tools (e.g. rope, pylint), but it is extensible and has a good facility for integrating external and custom tools.

Some of the things I like about Komodo go beyond the write-run-debug loop. ActiveState has long supported the development community (e.g. with free language builds, package repositories, a recipes site, …), since before dynamic languages were the trend. The base Komodo Edit editor is free and open source, an extension of Mozilla’s Firefox technologies. And Komodo is multi-lingual. I never end up doing just Python, just Perl, or just whatever. Komodo works with the core language (Python, Perl, Ruby, PHP, JavaScript) alongside supporting languages (XML, XSLT, SQL, X/HTML, CSS), non-dynamic languages (Java, C, etc.), and helpers (Makefiles, INI and config files, shell scripts, custom little languages, etc.) Others can do that too, but Komodo puts them all in once place, ready to go. It’s a Swiss Army Knife for dynamic languages. (This is contra PyCharm, e.g., which is great itself, but I’d need like a half-dozen of JetBrains’ individual IDEs to cover all the things I do).

Komodo IDE is by no means perfect, and editors/IDEs are the ultimate YMMV choice. But I am regularly delighted to use it, and every year I re-up my support subscription quite happily. Indeed, I just remembered! That’s coming up this month. Credit card: Out. I have no commercial connection to ActiveState–just a happy customer.


回答 18

您可能需要研究Eclim,这是一个Eclipse服务器,允许您从喜欢的文本编辑器中使用Eclipse功能。对于python相关功能,它在后台使用RopePyFlakesPyLint

You might want to look into Eclim, an Eclipse server that allows you to use Eclipse functionality from within your favorite text editor. For python-related functionality, it uses Rope, PyFlakes, and PyLint under the hood.


回答 19

我一直在使用的评估版Sublime Text。好的是它并没有真正过期。

到目前为止,一切都很好,而且非常容易上手。

I’ve been using an Evaluation copy of Sublime Text. What’s good is it doesn’t really expire.

It’s been good so far and was really easy to get started with.


回答 20

我为此可能会有点晚,但是我建议使用Aptana Studio3.x。它是基于eclipse的,并且可以随时使用python。对DJango, HTML5 and JQuery。对我来说,它是一个完美的Web开发工具。我也从事HTML5 and Android开发工作,因此无需切换其他IDE。这是我的多合一解决方案。

注意:您需要大量的RAM才能使它时髦!4+ GB太棒了!

I may be a little late for this, but I would recommend Aptana Studio 3.x . Its a based on eclipse and has everything ready-to-go for python. It has very good support for DJango, HTML5 and JQuery. For me its a perfect web-development tool. I do HTML5 and Android development too, this way I do not need to keep switching different IDE’s. It my all-in-one solution.

Note: you need a good amount of RAM for this to be snazzy !! 4+ GB is awesome !!


回答 21

Visual Studio代码 + 官方Python插件

在这里,您可以看到其当前Python功能的概述:

https://code.visualstudio.com/docs/languages/python

巧克力

http://chocolatapp.com

它轻巧,并提供代码完成功能。花费金钱。

编辑:显然,巧克力在2013年是一个有趣的选择,但此后许多其他人出现了,开发停滞了。如今,我建议使用Visual Studio Code + Python插件。

Visual Studio Code + Official Python Plugin

Here you see an overview of its current Python features:

https://code.visualstudio.com/docs/languages/python

Chocolat

http://chocolatapp.com

It’s lightweight and offers Code Completion. Costs money.

EDIT: Apparently Chocolat was an interesting option in 2013 but since then many others came up and development stalled. Nowadays I recommend Visual Studio Code + Python Plugin.


如何运行Python程序?

问题:如何运行Python程序?

所以我有点像Python,但是我遇到了问题……运行它。大声笑

我现在正在使用IDLE,但是它没有任何用处,因为您一次只能运行几行。

我还使用Komodo Edit创建实际的.py文件。

我的问题是,如何运行.py文件来测试实际程序?

我正在使用Windows 7和Komodo Edit 5作为我的IDE。在Komodo中按F5根本不起作用。

So I’m starting like Python a bit, but I’m having trouble erm…running it. Lol

I’m using IDLE for now, but its no use whatsoever because you can only run a couple of lines at a time.

I’m also using Komodo Edit to create the actual .py files.

My question is, how can I run the .py files to test out the actual program?

I’m using Windows 7, and Komodo Edit 5 as my IDE. Pressing F5 in Komodo doesn’t do anythin at all.


回答 0

我很高兴你问!我只是在Wikibook中解释这件事(显然是不完整的)。我们正在与Python新手合作,并且必须完全按照您的要求提供一些帮助!

Windows中的命令行Python:

  1. 使用编辑器中的“保存”或“另存为”将python代码文件保存在某处。让我们在某些文件夹中将其称为“ first.py”,例如您在桌面上创建的“ pyscripts”。

  2. 打开提示(Windows’cmd’shell,它是计算机的文本界面):

    开始>运行>“ cmd”(在小框中)。好。

  3. 使用命令“ cd”(更改目录)和“ dir”(显示目录中的文件,以验证您的头)导航到python文件所在的位置。对于我们的示例,

    > CD C:\ Documents and Settings \ Gregg \ Desktop \ pyscripts

  4. 尝试:

    > python first.py

如果收到此消息:

无法将“ python”识别为内部或外部命令,可操作程序或批处理文件。

然后是python解释器可以将Python转换为“计算机指令”程序)不在您的路径上(请参见下面的将Python放入路径中)。然后尝试这样调用它(假设安装在通常位置的Python2.6):

> C:\ Python26 \ python.exe first.py

(高级用户:您可以写出first.py的C:\ Documents and Settings \ Gregg \ Desktop \ pyscripts \ first.py的完整路径,而不是first.py)

将Python放在您的路径上

视窗

为了运行程序,您的操作系统会在各个地方出现,并尝试将您键入的程序/命令的名称与过程中的某些程序进行匹配。

在Windows中:

控制面板>系统>高级> |环境变量| >系统变量->路径

这需要包括:C:\ Python26; (或同等学历)。如果将其放在最前面,它将是第一位。您也可以在末尾添加它,这可能会更好。

然后重新启动提示,并尝试键入“ python”。如果一切正常,您应该收到一个“ >>>”提示。

I’m very glad you asked! I was just working on explaining this very thing in our wikibook (which is obviously incomplete). We’re working with Python novices, and had to help a few through exactly what you’re asking!

Command-line Python in Windows:

  1. Save your python code file somewhere, using “Save” or “Save as” in your editor. Lets call it ‘first.py’ in some folder, like “pyscripts” that you make on your Desktop.

  2. Open a prompt (a Windows ‘cmd’ shell that is a text interface into the computer):

    start > run > “cmd” (in the little box). OK.

  3. Navigate to where your python file is, using the commands ‘cd’ (change directory) and ‘dir’ (to show files in the directory, to verify your head). For our example something like,

    > cd C:\Documents and Settings\Gregg\Desktop\pyscripts

  4. try:

    > python first.py

If you get this message:

‘python’ is not recognized as an internal or external command, operable program or batch file.

then python (the interpreter program that can translate Python into ‘computer instructions’) isn’t on your path (see Putting Python in Your Path below). Then try calling it like this (assuming Python2.6, installed in the usual location):

> C:\Python26\python.exe first.py

(Advanced users: instead of first.py, you could write out first.py’s full path of C:\Documents and Settings\Gregg\Desktop\pyscripts\first.py)

Putting Python In Your Path

Windows

In order to run programs, your operating system looks in various places, and tries to match the name of the program / command you typed with some programs along the way.

In windows:

control panel > system > advanced > |Environmental Variables| > system variables -> Path

this needs to include: C:\Python26; (or equivalent). If you put it at the front, it will be the first place looked. You can also add it at the end, which is possibly saner.

Then restart your prompt, and try typing ‘python’. If it all worked, you should get a “>>>” prompt.


回答 1

你可以打电话

python /path/to/filename.py

You can just call

python /path/to/filename.py

回答 2

在IDLE中按F5

您可以使用IDLE打开您的.py文件,然后按F5键运行它。

您可以使用其他编辑器(如您所说的Komodo)打开同一文件,然后保存并再次按F5。F5与IDLE一起使用(即使使用其他工具完成编辑)。

如果您想根据本文直接从Komodo运行它:在Komodo Edit中执行Python代码,您必须:

  1. 转到工具箱->添加->新命令…
  2. 在顶部字段中输入名称“运行Python文件”
  3. 在“命令”字段中输入以下文本:

    %(python)%F 3.a可选单击“键绑定”选项卡,然后为该命令分配一个键盘命令

  4. 单击确定。

In IDLE press F5

You can open your .py file with IDLE and press F5 to run it.

You can open that same file with other editor ( like Komodo as you said ) save it and press F5 again; F5 works with IDLE ( even when the editing is done with another tool ).

If you want to run it directly from Komodo according to this article: Executing Python Code Within Komodo Edit you have to:

  1. go to Toolbox -> Add -> New Command…
  2. in the top field enter the name ‘Run Python file’
  3. in the ‘Command’ field enter this text:

    %(python) %F 3.a optionall click on the ‘Key Binding’ tab and assign a key command to this command

  4. click Ok.

回答 3

Python本身带有一个编辑器,您可以从“ IDLE文件”>“新建文件”菜单选项进行访问。

将代码写入该文件,将其另存为[filename] .py,然后(在同一文件编辑器窗口中)按F5键执行在IDLE Shell窗口中创建的代码。

注意:到目前为止,这只是我最简单,最直接的方法。

Python itself comes with an editor that you can access from the IDLE File > New File menu option.

Write the code in that file, save it as [filename].py and then (in that same file editor window) press F5 to execute the code you created in the IDLE Shell window.

Note: it’s just been the easiest and most straightforward way for me so far.


回答 4

如果您不想通话filename.py,可以将其添加.PY到PATHEXT中,那样您就可以调用filename

if you dont want call filename.py you can add .PY to the PATHEXT, that way you will just call filename


回答 5

如果这对任何人都有用,则“ python [filename] .py”或“ python.exe [filename.py]”都不适合我,但“ start python [filename] .py”却没有帮助。如果其他任何人在使用前两个命令时遇到问题,请尝试使用后一个命令。

If this helps anyone, neither “python [filename].py” or “python.exe [filename.py]” worked for me, but “start python [filename].py” did. If anyone else is experiencing issues with the former two commands, try the latter one.


回答 6

我刚才所做的是,通过双击打开一个简单的python脚本。我刚刚将一个批处理文件添加到包含脚本的目录中:

@echo off
python exercise.py
pause>nul

(我的系统路径上有python可执行文件。如果不需要,当然要包括其完整路径。)

然后,我可以双击批处理文件来运行脚本。第三行防止脚本结束后立即关闭cmd窗口,因此您可以看到结果。:)完成后,只需关闭命令窗口即可。

What I just did, to open a simple python script by double clicking. I just added a batch file to the directory containing the script:

@echo off
python exercise.py
pause>nul

(I have the python executable on my system path. If not one would need include its complete path of course.)

Then I just can double click on the batch file to run the script. The third line keeps the cmd window from being dismissed as soon as the script ends, so you can see the results. :) When you’re done just close the command window.


回答 7

导航您的文件位置,只需按Shift按钮,然后单击文件名。单击选项卡,Open command window here然后在命令提示符下写入python file_name.py

Navigate your file location just press Shift button and click file name. Click tab Open command window here and write in your command prompt python file_name.py


回答 8

如果要运行#’。py’文件,只需在代码中写入print()即可实际看到它被打印出来。与python IDLE不同,您需要使用print()命令指定要打印的内容。例如。

import os
os.getcwd()
a=[1,2,3,4,5]
name= 'Python'
# Use print() function
print(a)
print(name)

输出[1、2、3、4、5] Python

If you want to run the #’.py’ file just write in print() in your code to actually see it get printed. Unlike python IDLE, you need to specify what you want to print using print() command. For eg.

import os
os.getcwd()
a=[1,2,3,4,5]
name= 'Python'
# Use print() function
print(a)
print(name)

OUTPUT [1, 2, 3, 4, 5] Python


回答 9

我已经尝试了上面列出的许多命令,但是即使将路径设置为包括我安装Python的目录之后,这些命令也没有起作用。

该命令py -3 file.py始终对我有用,如果我想运行Python 2代码,只要Python 2在我的路径中,只需将命令更改为py -2 file.py完美即可。

我正在使用Windows,因此我不太确定此命令是否可以在Linux或Mac上运行,但是值得一试。

I have tried many of the commands listed above, however none worked, even after setting my path to include the directory where I installed Python.

The command py -3 file.py always works for me, and if I want to run Python 2 code, as long as Python 2 is in my path, just changing the command to py -2 file.py works perfectly.

I am using Windows, so I’m not too sure if this command will work on Linux, or Mac, but it’s worth a try.


Django开发IDE [关闭]

问题:Django开发IDE [关闭]

我已经做了一些Django开发,但是所有工作都在文本编辑器中进行。我很好奇其他人在Django开发中使用了哪些更高级的开发工具。

我习惯使用Visual Studio进行开发,并且真的很喜欢它提供的IntelliSense,代码完成和文件组织,并且希望找到可以在Django / Python环境中提供某些功能的工具(或工具组合)。

I have done a little Django development, but it has all been in a text editor. I was curious what more advanced development tools others are using in their Django development.

I am used to using Visual Studio for development and really like the IntelliSense, code completion, and file organization it provides and would like to find something (or a combination of tools) that would provide some of this in the Django/Python environment.


回答 0

我使用Eclipse和普通的PyDev。没有任何特定的Django功能。我想到的最好的方法是设置运行配置文件以运行开发Web服务器。

如果添加Web工具项目(WTP),则模板中的语法将突出显示,但是与特定模板语言无关的内容将不会突出显示。PyDev是一个不错的插件,如果您已经熟悉Eclipse并将其用于其他项目,则是一个不错的选择。

我记得NetBeans开始获得Python支持,但是我不知道现在在哪里。许多人对NetBeans 6赞不绝口,但是在Java世界中,Eclipse仍然是OSS IDE的王者。

I use Eclipse and a plain vanilla PyDev. There isn’t any specific Django functionality. The best I came up with was setting up a run profile to run the development web server.

If you add the web tools project (WTP), you’ll get syntax highlighting in your templates, but nothing that relates to the specific template language. PyDev is a decent plugin, and if you are already familiar with Eclipse and use it for other projects it is a good way to go.

I recall NetBeans starting to get Python support, but I have no idea where that is right now. Lots of people rave about NetBeans 6, but in the Java world Eclipse still reigns as the king of the OSS IDEs.


回答 1

PyCharm从支持Django和JetBrains的谷歌应用程序。看起来很有希望。

注意:如果要Django支持,则需要购买Professional版本的许可证。社区版本不支持Django。

There is PyCharm from JetBrains which supports Django and Google Apps. It looks promising.

Note: You need to buy a license for the Professional version if you want Django support. The Community version desn’t support Django.


回答 2

我使用Vim:

http://github.com/skyl/vim-config-python-ide

[更新]

Sublime Text 2非常棒。如果需要,它支持许多Vim命令:Vintage Mode

它有一个不错的包管理器:http : //wbond.net/sublime_packages/package_control

到目前为止,我使用这些软件包:

贾内罗

设置Django语法

CoffeeScript

崇高的林特

主题-苏打水

补充工具栏

我仍然喜欢Vim,但是…我是否提到Sublime Text插件是用Python编写的?

I use Vim:

http://github.com/skyl/vim-config-python-ide

[UPDATE]

Sublime Text 2 is pretty awesome. It supports a lot of Vim commands if you want them: Vintage Mode

It has a nice package manager: http://wbond.net/sublime_packages/package_control

I use these packages so far:

Djaneiro

SetDjangoSyntax

CoffeeScript

SublimeLinter

Theme – Soda

SideBarEnhancements

I still love Vim but … did I mention that Sublime Text plugins are written in Python?


回答 3

我使用Komodo Edit。签出打开Komodo编辑。

I use Komodo Edit. Check out the Open Komodo Edit.


回答 4


回答 5

我开始喜欢使用Aptana Studios + PyDev(和其他)插件进行各种Web应用程序开发。如您所知,它建立在强大的Eclipse之上,但是是专门为专注于Web应用程序开发而设计的。

I am beginning to enjoy working with Aptana Studios + PyDev (and other) plugins for all sorts of web application development. As you can tell, it is built on top of the powerful Eclipse, but is tailor-designed to focus on web application development.


回答 6

我的大多数开发工作都使用Kate(KDE高级文本编辑器),包括Django。它同时具有Python和Django模板语法高亮显示。当项目的很大一部分涉及HTML时,我将切换到Quanta +。

由于它使用了Kate的KPart,因此它对于编辑Python部件和HTML模板都同样有用,我拥有完整的Quanta +工具,同时还保留了Django特有的标记。

2013年更新:不幸的是,Quanta +已经死了很多年了,而且它永远也不会复活。另外,那里没有其他可用的HTML编辑器,所以现在一直都是Kate。

I use Kate (KDE Advanced Text Editor) for most of my development, including Django. It has both a Python and Django Templates syntax higlighting. I switch to Quanta+ when a significant part of the project involves HTML.

Since it uses Kate’s KPart, it’s just as good for editing the Python parts, and for the HTML templates i have the whole Quanta+ tools, while still highligting Django-specific tags.

Update 2013: Unfortunately, Quanta+ has been dead for years now, and there’s no hope that it will ever be resurrected. Also, there’s no other usable HTML editor out there, so it’s Kate all the time now.


回答 7

NetBeans for Python是我当前的最爱(比我发现的Eclipse更轻巧,更容易安装)。支持简单的重构,自动完成,错误/警告…

Eclipse Aptana PyDev可能是当今最完整的免费IDE之一(未经大量测试)

Wingware Python IDE是一种商业IDE,具有一些Django特定的项目设置功能,可以调试Django模板文件。

IntelliJ IDEA Ultimate Edition是另一个商业IDE,它也有正在大力开发的Python插件。我看到了一些演示,该演示在自动完成方面非常有前途(对于模板和Python)。

我仍然使用一个小的触摸修复程序的 Vim。另请参阅: Django的额外调整

NetBeans for Python is my current favorite (lighter and so much easier to install than Eclipse I found). Supports simple refactoring, autocompletion, errors/warnings…

Eclipse Aptana PyDev probably one of the most complete free IDE nowadays (haven’t tested a lot)

Wingware Python IDE a commercial IDE, which has some Django-specific project setup features the ability to debug Django template files.

IntelliJ IDEA Ultimate Edition another commercial IDE which has also a plugin for Python that is under heavy development. I saw some demo which look very promising on the auto-completion (for templates and Python).

Vim which I still use a small touch-fix application. See also: Extra tweaks for Django.


回答 8

PyCharm。到目前为止,我最好尝试过适用于Python,Django和Web开发的IDE。这是完全值得的钱。

PyCharm. It is best the IDE for Python,Django, and web development I’ve tried so far. It is totally worth the money.


回答 9

你们应该结帐PyCharm!这是第一个像样的Django IDE。

You guys should checkout PyCharm! It is the first decent Django IDE.


回答 10

Eclipse具有用于python开发的PyDev插件。不幸的是,我不确定它与Django集成得如何。

Eclipse has the PyDev plugin for python development. Unfortunately, I’m not sure how well it integrates with Django.


回答 11

据我所知,没有适用于Django的“ IDE”,但是有一些现成的支持Django的IDE,特别是模板的Django语法。

名字叫Komodo,它具有很多功能,但并不便宜。如果您不担心源代码控制或调试,那么有一个免费版本称为Komodo Edit

As far as I know there is not “an IDE” for Django, but there are some IDEs that support Django right out of the box, specifically the Django syntax for templates.

The name is Komodo, and it has a lot of features, but it’s not cheap. If you are not worried about source control or debugging then there is a free version called Komodo Edit.


回答 12

Visual Studio有一个实际的Python扩展:http : //pytools.codeplex.com/。真是太棒了。感觉就像我使用任何本地Visual Studio语言进行编码一样。该扩展甚至与Django兼容。最好的是:它是完全免费的。即使对于Visual Studio,它也只需要Visual Studio Shell即可运行,这是完全免费的。

There is an actual Python extension for Visual Studio: http://pytools.codeplex.com/. It’s absolutely fantastic. It feels the same as if I were coding in any native Visual Studio language. The extension is even compatabile with Django. And best of all: it’s totally free. Even for Visual Studio, it only requires the Visual Studio Shell to work, which is completely free.


回答 13

现在,您还可以使用Visual Studio2010。操作方法如下:

  • 下载并安装适用于Visual Studio的Python工具
  • 根据现有代码创建一个新项目(菜单文件新建来自现有代码的项目…
  • 指定您的Django项目文件夹并使用默认值。
  • 右键单击manage.py,然后选择设置为启动文件
  • 在项目属性的“ 调试”选项卡中,在“ 脚本参数 ”中添加“ runserver” 。
  • 您可以设置断点,并附加到Python进程进行调试。如果要调试而不必“附加到进程”,请在脚本参数中使用“ runserver –noreload”。但是,“-noreload”意味着您必须手动停止并重新启动Django开发Web服务器(以识别代码更改)。

如果您已经使用Visual Studio,这是一个很好的设置。

Python工具已更新。现在,它已经内置了对Django的支持。

Now you can also use Visual Studio 2010. Here’s how:

  • Download and install Python Tools for Visual Studio.
  • Create a new project from existing code (menu FileNewProject From Existing Code…)
  • Specify your Django project folder and use the defaults.
  • Right-click on manage.py and choose Set as Startup File.
  • In your project properties Debug tab, add “runserver” in Script Arguments.
  • You can set break points, and attach to the Python process for debugging. If you want to debug without having to “attach to process,” use “runserver –noreload” in your script arguments. However, the “–noreload” means you’ll have to stop and restart the Django development web server manually (to recognize your code changes).

This is a nice setup if you already use Visual Studio.

Python Tools has been updated. It has built in support for Django now.


回答 14

PyCharm,当然。我几乎全部尝试了它们,但是PyCharm是我发现对任何繁重开发工作最有用的工具。

简单来说,脚本一次使用的是我想到的任何内容(TextMate,Vim,Emacs,TextWrangler等,您都可以命名)。

PyCharm, definitely. I tried them all (almost), but PyCharm is the one I found most useful for any heavy development.

For simple, one time, scripts I use whatever comes to mind (TextMate, Vim, Emacs, TextWrangler, etc., you name it).


回答 15

我已经在PyDev和PyCharm中使用了Eclipse。PyCharm绝对是我尝试过的Django / Python的最佳IDE。它会为所有对象进行适当的模板突出显示和自动补全。它还可以进行跨文件引用。

它相当昂贵,但是绝对是我尝试过的最好的Django IDE。您可以在http://www.jetbrains.com/pycharm/download/上进行30天的评估。

I have used Eclipse with PyDev and PyCharm. PyCharm is definitely the best IDE for Django/Python I have tried. It does proper template highlighting and auto-completion for all objects. It also does cross-file referencing.

It’s quite expensive, but definitely the best Django IDE I have tried. You can try a 30 day evaluation at http://www.jetbrains.com/pycharm/download/.


回答 16

好吧,我一直在用自己的。最近,他们发布了Alpha版本。在这里是pfaide.com/

Well, I’ve been using my own one. Recently they released an alpha version. Here it is at pfaide.com/.


回答 17

我在Eclipse和Pydev上也取得了不错的成绩。尽管我仍然需要打开一个打开到项目目录的外壳来运行manage.py命令。我还一直将其与Bazaar插件一起用于版本控制和与服务器同步代码。

I’ve also had good results with Eclipse and Pydev. Although I still require a shell opened to the project directory to run manage.py commands. I’ve also been using it with the Bazaar plugin for revision control and syncing code with the server.


回答 18

我非常喜欢E Text Editor,因为它几乎是TextMate与Windows 的“连接” 。显然Django是基于Python的,对自动完成功能的支持是有限的(没有像intellisense这样的东西需要专门的IDE来了解每个库的复杂性),但是使用摘要和“单词完成”功能有很大帮助。此外,它还支持Django Python文件和模板文件以及CSS,HTML等。

我已经使用E Text Editor很长时间了,可以告诉您,在使用Django时,它胜过PyDev和Komodo Edit。对于其他类型的项目,PyDev和Komodo可能更合适。

I really like E Text Editor as it’s pretty much a “port” of TextMate to Windows. Obviously Django being based on Python, the support for auto-completion is limited (there’s nothing like intellisense that would require a dedicated IDE with knowledge of the intricacies of each library), but the use of snippets and “word-completion” helps a lot. Also, it has support for both Django Python files and the template files, and CSS, HTML, etc.

I’ve been using E Text Editor for a long time now, and I can tell you that it beats both PyDev and Komodo Edit hands down when it comes to working with Django. For other kinds of projects, PyDev and Komodo might be more adequate though.


回答 19

我也用凯特。凯特的简单性是其最大的特色。它不会妨碍您。(这当然是高度主观的意见。)

Kate包括一个Python代码浏览器插件。但这对IMO没有用。更改代码/视图时不会自动更新。另外,更新时,整个树都将折叠,并且您必须自己再次对其进行扩展。点击次数过多。

相反,我使用了Pâté随附的Source Browser插件。确实确实会导致Kate暂时冻结,但到目前为止没有崩溃或此类事件。

无耻的博客插件:有关将Django与Kate(Pâté)结合使用的更多信息

I use Kate as well. Kate’s simplicity is its biggest feature. It doesn’t get in your way. (This is of course highly subjective opinion.)

Kate includes a Python code browser plugin. But it isn’t useful IMO. No automatic updates when you change the code/view. Also when you update, the whole tree is collapsed, and you have to expand it again yourself. Too many clicks.

Instead, I use the Source Browser plugin that comes with Pâté. It does cause Kate to freeze temporarily sometimes, but no crashes or anything of that sort so far.

Shameless blog plug: more on using Django with Kate (Pâté)


回答 20

如果您喜欢Vim作为编辑器,那么这里有一些有关如何针对Django开发进行调优的建议(直至完整的IDE):http : //code.djangoproject.com/wiki/UsingVimWithDjango

If you like Vim as an editor, here are some suggestions on how to tune it (up to the point of a full fledged IDE) for Django development: http://code.djangoproject.com/wiki/UsingVimWithDjango.


回答 21

Editra支持Django模板语言语法突出显示。您可以将其配置为更好的记事本或基本的IDE。

Editra supports Django Template Language syntax highlighting. You can configure it either as a better Notepad or a basic IDE.


回答 22

我写了一篇有关NetBeans对Django的新的和即将推出的支持的博客文章。当与它已经非常出色的Python,JavaScript,HTML和CSS支持配合使用时,在我看来,它是一个不错的选择!

I made a blog post about NetBeans’ new and upcoming support for Django. When paired with its already fantastic Python, JavaScript, HTML and CSS support, it’s a strong candidate in my mind!


回答 23

安装了Django和django-html捆绑软件的TextMate为您提供语法突出显示和出色的可扩展性。它轻巧且使用有趣。

是指向Python的TextMate的代码完成项目的链接(我自己没有使用过)。至于“智能”(据我理解是内联文档参考),TextMate也有。

TextMate with the Django and django-html bundles installed gives you syntax highlighting and great extensibility. It is lightweight and fun to use.

Here is a link to a code completion project for TextMate with Python (which I haven’t used myself). As for “intellisense” (which I understand to be inline-doc reference), TextMate has that too.


回答 24

来自http://www.wingware.com的Wingware编辑器特定于Python,并且对Python / Django / Zope等具有很好的自动完成功能。

它具有一个内置的Python外壳程序来运行代码片段(或选择并运行),并支持Mercurial / Git等,以及一个内置的unittest / nose / doctest测试运行程序。虽然它是商业性的,但是因为它是用Python编写的,所以它是跨平台的。

我前一阵子买了它,以为它看起来很笨拙,但是我已经尝试了所有这些并继续回来。请注意,我是Windows专家,没有Emacs或Vim技能,因此无法利用它。Mac版本需要X Window,并且似乎更容易出错。

The Wingware editor from http://www.wingware.com is Python-specific with very good auto-completion for Python/Django/Zope, etc.

It has a built in Python shell to run snippets (or select and run) and support for Mercurial/Git, etc. and a built-in unittest/nose/doctest test runner. It’s commercial though, but as it is written in Python, it’s cross platform.

I bought it a while ago, and thought it looked dorky, but I’ve tried them all and keep coming back. Caveat that I am a Windows guy with no Emacs or Vim skills, so leveraging that was not an option. And the Mac version requires X Window and seems to be more glitchy.


回答 25

盖尼

它基于GTK2,快速,轻巧,可用于Linux和Windows。

Geany

It is GTK2 based, fast, lightweight, available for Linux and Windows.


回答 26


回答 27

Ulipad是个不错的选择。 http://code.google.com/p/ulipad/


回答 28

我一直使用Vim或Kate,但我更希望使用成熟的IDE。鉴于它不像Visual Studio那么重。

I have consistently used Vim or Kate, but I would prefer a full-blown IDE. Given it is not as heavy as Visual Studio.


回答 29

我自己喜欢Eclipse + PyDev和/或eric。PyDev的新版本提供了一些非常出色的代码完成支持。

由于我将Eclipse用于PyDev,因此我使用Platform Runtime Binary + PyDev + Subclipse的精简安装。

I like Eclipse + PyDev and/or eric, myself. The new version of PyDev has some pretty awesome code completion support.

Since I only use Eclipse for PyDev, I use a slim install of just the Platform Runtime Binary + PyDev + Subclipse.


如何从Sublime Text 2运行Python代码?

问题:如何从Sublime Text 2运行Python代码?

我想在Sublime Text 2中设置完整的Python IDE。

我想知道如何从编辑器中运行Python代码。使用构建系统完成吗?我该怎么做 ?

I want to set up a complete Python IDE in Sublime Text 2.

I want to know how to run the Python code from within the editor. Is it done using build system? How do I do it ?


回答 0

工具->构建系统->(选择)Python然后:

跑步:

      Tools -> Build

      -or-

      Ctrl + B

      CMD + B  (OSX)

这将在控制台中启动您的文件,该控制台应位于编辑器的底部。

停止:

       Ctrl + Break or Tools -> Cancel Build

       Fn + C (OSX)

您可以在Break此处找到密钥的位置:http : //en.wikipedia.org/wiki/Break_key

注意:CTRL + C工作。

Ctrl + Break不起作用时该怎么办:

去:

首选项->键绑定-用户

并粘贴以下行:

{"keys": ["ctrl+shift+c"], "command": "exec", "args": {"kill": true} } 

现在,您可以使用ctrl+shift+c代替CTRL+BREAK

Tools -> Build System -> (choose) Python then:

To Run:

      Tools -> Build

      -or-

      Ctrl + B

      CMD + B  (OSX)

This would start your file in the console which should be at the bottom of the editor.

To Stop:

       Ctrl + Break or Tools -> Cancel Build

       Fn + C (OSX)

You can find out where your Break key is here: http://en.wikipedia.org/wiki/Break_key.

Note: CTRL + C will NOT work.

What to do when Ctrl + Break does not work:

Go to:

Preferences -> Key Bindings – User

and paste the line below:

{"keys": ["ctrl+shift+c"], "command": "exec", "args": {"kill": true} } 

Now, you can use ctrl+shift+c instead of CTRL+BREAK


回答 1

在Mac OS X上,以.py扩展名保存文件。按+ B。它在下面的窗口中运行。

On Mac OS X, save your file with a .py extension. Press + B. It runs in a window below.


回答 2

编辑%APPDATA%\ Sublime Text 2 \ Python \ Python.sublime-build

将内容更改为:

{
    "cmd": ["C:\\python27\\python.exe", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}

将“ c:\ python27”部分更改为系统中具有的任何版本的python。

Edit %APPDATA%\Sublime Text 2\Python\Python.sublime-build

Change content to:

{
    "cmd": ["C:\\python27\\python.exe", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}

change the “c:\python27” part to any version of python you have in your system.


回答 3

要运行CtrlB(通过回答matiit

但是当CtrlB 不起作用时,Sublime Text可能找不到Python解释器。尝试运行程序时,请参阅日志并在路径中找到对Python的引用。

[cmd:  [u'python', u'-u', u'C:\\scripts\\test.py']]
[path: ...;C:\Python27 32bit;...]

关键是它试图通过命令行运行python,cmd如下所示:

python -u C:\scripts\test.py

如果您无法从cmd运行python,那么Sublime Text也不会。
(在cmd中自己尝试,在其中键入python并运行它,应该显示python命令行)

您可以更改Sublime Text构建公式或System %PATH%

  • 要设置您的%PATH%
    * 您将需要重新启动编辑器以加载新的%PATH%

    • 运行命令行*,然后输入以下命令:*需要以管理员
      SETX /M PATH "%PATH%;<python_folder>"
      身份运行,例如:SETX /M PATH "%PATH%;C:\Python27;C:\Python27\Scripts"

    • 手动:(最好)在字符串末尾
      添加;C:\Python27;C:\Python27\Scripts

  • 要设置解释器的路径而不弄乱系统,%PATH%请参阅ppy的答案。

To RUN press CtrlB (answer by matiit)

But when CtrlB does not work, Sublime Text probably can’t find the Python Interpreter. When trying to run your program, see the log and find the reference to Python in path.

[cmd:  [u'python', u'-u', u'C:\\scripts\\test.py']]
[path: ...;C:\Python27 32bit;...]

The point is that it tries to run python via command line, the cmd looks like:

python -u C:\scripts\test.py

If you can’t run python from cmd, Sublime Text can’t too.
(Try it yourself in cmd, type python in it and run it, python commandline should appear)

SOLUTION

You can either change the Sublime Text build formula or the System %PATH%.

  • To set your %PATH%:
    *You will need to restart your editor to load new %PATH%

    • Run Command Line* and enter this command: *needs to be run as administrator
      SETX /M PATH "%PATH%;<python_folder>"
      for example: SETX /M PATH "%PATH%;C:\Python27;C:\Python27\Scripts"

    • OR manually: (preferable)
      Add ;C:\Python27;C:\Python27\Scripts at the end of the string.

  • To set the interpreter’s path without messing with System %PATH% see this answer by ppy.


回答 4

您可以使用SublimeREPL(首先需要安装Package Control)。

You can use SublimeREPL (you need to have Package Control installed first).


回答 5

如果使用python 3.x,则需要编辑 Python3.sublime-build

(首选项>浏览包> Python 3)

看起来像这样:

{
  "path": "/usr/local/bin",
  "cmd": ["python3", "-u", "$file"],
  "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
  "selector": "source.python"
}

If using python 3.x you need to edit the Python3.sublime-build

(Preferences > Browse packages > Python 3)

to look like this:

{
  "path": "/usr/local/bin",
  "cmd": ["python3", "-u", "$file"],
  "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
  "selector": "source.python"
}

回答 6

[这适用于ST3(Win),不确定ST2]

要使输出在Sublime中作为另一个文件可见(为错误显示一个文件),请执行以下操作:

  1. 创建一个新的构建系统: Tools > Build Systems > New Build System...
  2. 使用以下配置:
    {
        “ cmd”:[“ python.exe”,“ $ file”,“ 1>”,“ $ file_name .__ STDOUT __。txt”,“ 2>”,“ $ file_name .__ STDERR __。txt”],
        “ selector”:“ source.python”,
        “外壳”:是的,
        “ working_dir”:“ $ file_dir”
    }
  1. 对于您的Python文件,选择上面的构建系统配置文件: Tools > Build Systems > {your_new_build_system_filename}
  2. ctrl + b
  3. 现在,在文件旁边,例如,"file.py"您将拥有"file.__STDOUT__.py""file.__STDERR__.py"(对于错误,如果有的话)
  4. 如果将窗口分为三列或一个网格,您将立即看到结果,而无需切换面板/窗口

[ This applies to ST3 (Win), not sure about ST2 ]

To have the output visible in Sublime as another file (+ one for errors), do this:

  1. Create a new build system: Tools > Build Systems > New Build System...
  2. Use the following configuration:

    {
        "cmd": ["python.exe", "$file", "1>", "$file_name.__STDOUT__.txt", "2>", "$file_name.__STDERR__.txt"],
        "selector": "source.python",
        "shell": true,
        "working_dir": "$file_dir"
    }
  1. For your Python file select the above build system configuration file: Tools > Build Systems > {your_new_build_system_filename}
  2. ctrl + b
  3. Now, next to your file, e.g. "file.py" you’ll have "file.__STDOUT__.py" and "file.__STDERR__.py" (for errors, if any)
  4. If you split your window into 3 columns, or a grid, you’ll see the result immediately, without a need to switch panels / windows

回答 7

酷你们,我刚发现这个:

http://ptomato.wordpress.com/2012/02/09/geek-tip-running-python-guis-in-sublime-text-2/

它解释了(像上面的答案之一一样)如何在默认目录中编辑此exec.py。

我的问题是我的PYTHON UI APPLICATION无法启动。我从以下片段中注释掉了最后一行:

    # Hide the console window on Windows
    startupinfo = None
    if os.name == "nt":
        startupinfo = subprocess.STARTUPINFO()
        #startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW

而且,taaadaaaa,我可以通过按Ctrl + B来启动我的应用。有趣的话,嗯?非常感谢您写这篇文章的人;-)

Cool U guys, I just found this:

http://ptomato.wordpress.com/2012/02/09/geek-tip-running-python-guis-in-sublime-text-2/

It explains (like one of the answers above) how to edit this exec.py in the default directory.

I had the problem that my PYTHON UI APPLICATION would not start. I commented out the last line from the following snipped:

    # Hide the console window on Windows
    startupinfo = None
    if os.name == "nt":
        startupinfo = subprocess.STARTUPINFO()
        #startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW

and, taaadaaaa, I could start my app by pressing Ctrl+B. Funny line anyways, uh? And a big thank you to whoever wrote that article ;-)


回答 8

您可以通过“查看/显示控制台”或Ctrl+ 访问Python控制台`

You can access the Python console via “View/Show console” or Ctrl+`.


回答 9

我解决了这个问题:

> Preferences –> Browse Packages –> Default 

打开第exec.py41-42行附近的文件,代码应如下所示:

for k, v in proc_env.iteritems():
    proc_env[k] = os.path.expandvars(v).encode(sys.getfilesystemencoding())

然后将其删除或编辑为:

try:    
    for k, v in proc_env.iteritems():
        proc_env[k] = os.path.expandvars(v).encode(sys.getfilesystemencoding())
except:
    print 'foobar'

I solved this problem :

> Preferences –> Browse Packages –> Default 

Open the exec.py file, near line 41-42, the code should look like this :

for k, v in proc_env.iteritems():
    proc_env[k] = os.path.expandvars(v).encode(sys.getfilesystemencoding())

then delete it or edit it as :

try:    
    for k, v in proc_env.iteritems():
        proc_env[k] = os.path.expandvars(v).encode(sys.getfilesystemencoding())
except:
    print 'foobar'

回答 10

我今天遇到了同样的问题。这是我设法在Sublime Text 3中运行python代码的方式:

  1. Ctrl+ B(对于Mac,+ B)开始构建系统。它应该立即执行文件。
  2. 遵循此答案以了解如何自定义构建系统。

接下来,您需要将内容替换Python.sublime-build

{
    "cmd": ["/usr/local/bin/python", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
}

您当然可以进一步自定义它以适合您的需求。

I ran into the same problem today. And here is how I managed to run python code in Sublime Text 3:

  1. Press Ctrl + B (for Mac, + B) to start build system. It should execute the file now.
  2. Follow this answer to understand how to customise build system.

What you need to do next is replace the content in Python.sublime-build to

{
    "cmd": ["/usr/local/bin/python", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
}

You can of course further customise it to something that works for you.


回答 11

在python v3.x中,您应该转到:Tools->Build System->New Build System

然后,在sublime文本编辑器中弹出untitled.sublime-build窗口,输入设置为:

{

    "cmd": ["path_to_the_python.exe","-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}

要查看路径,请执行以下操作Type following in terminal as

python
>>> import sys
>>>print(sys.executable)

您可以制作多个构建系统,但默认情况下,应将其保存在具有.sublime-build扩展名的Sublime文本包中

然后,选择新的构建系统 ,然后cltr+b根据您的操作系统按或其他。

In python v3.x you should go to : Tools->Build System->New Build System.

Then, it pop up the untitled.sublime-build window in sublime text editor.Enter setting as:

{

    "cmd": ["path_to_the_python.exe","-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}

To see the path, Type following in terminal as:

python
>>> import sys
>>>print(sys.executable)

You can make more than one Build System but it should default save inside Packages of Sublime text with .sublime-build extension.

Then, select the new Build System and press cltr+b or other based on your os.


回答 12

我有同样的问题。您可能尚未保存文件。确保使用.py扩展名保存您的代码,并且该代码应该可以工作。

I had the same problem. You probably haven’t saved the file yet. Make sure to save your code with .py extension and it should work.


回答 13

关于上述构建系统要注意的一件事:您可以编写(并使用)自定义.sublime-build文件,甚至可以编写每个项目build_systems子句(在项目设置中)。这使您可以做一些有用的事情,例如使用ANSI颜色输出的精美测试运行程序

要获得更多的“完整IDE”功能,可以使用出色的SublimePythonIDE软件包:

  • 代码完成(英特尔)
  • 跳转到定义和对象描述
  • 适当的棉绒/ pep8
  • 用virtualenv支持不同的解释器

披露:我已经贡献了PR该程序包,我用它所有的时间,但 其他人

One thing to note about the aforementioned build system: you can write (and use) custom .sublime-build files or even per project build_systems clause (in your project settings). This allows you to do useful things like a fancy test runner with ANSI colors output.

For even more “full IDE” features, you can use the excellent SublimePythonIDE package:

  • code completion (intel)
  • jump to definition & object description
  • proper linting/pep8
  • supports different interpreters with virtualenv

Disclosure: I’ve contributed a PR to that package, and I use it all the time, but there are others.


回答 14

在Sublime旁边使用真正的python控制台

Sublime的构建系统和SublimeREPL(上面的答案)都受到限制,因为您在运行文件后无法轻松地与工作空间变量进行交互。

如果要运行脚本,然后以类似于REPL的方式工作(就像在IDE中一样),则建议将Sublime与IPython控制台一起打开。您可以使用AutoHotKey(Windows)或AutoKey(Linux)进行设置,以使单个快捷方式将复制文件名(或仅复制所选的代码),然后将其粘贴到控制台中以运行文件。

LinuxWindows的详细说明

Use a real python console alongside Sublime

Both Sublime’s build system and SublimeREPL (the answers above) are limited in that you can’t easily interact with the workspace variables after you run your file.

If you want to run a script, then work in a REPL-like fashion (like you would in an IDE), then I recommend having Sublime open alongside an IPython console. Using AutoHotKey (Windows) or AutoKey (Linux), you can set this up such that a single shortcut will copy the filename (or just the selected code) and then paste this in the console to run the file.

Detailed instructions for Linux or Windows


PyCharm中未解决的参考问题

问题:PyCharm中未解决的参考问题

我有一个目录结构

├── simulate.py
├── src
   ├── networkAlgorithm.py
   ├── ...

而且我可以使用访问网络模块sys.path.insert()

import sys
import os.path
sys.path.insert(0, "./src")
from networkAlgorithm import *

但是,pycharm抱怨它无法访问该模块。我如何教pycham解析参考文献?

I have a directory structure

├── simulate.py
├── src
│   ├── networkAlgorithm.py
│   ├── ...

And I can access the network module with sys.path.insert().

import sys
import os.path
sys.path.insert(0, "./src")
from networkAlgorithm import *

However, pycharm complains that it cannot access the module. How can I teach pycham to resolve the reference?


回答 0

手动将其添加为你所做确实这样做的一种方式,但有一个简单的方法,那就是通过简单地告诉pycharm要在添加src文件夹作为源根目录,然后添加源根你的Python路径。

这样,您就不必将代码硬编码到解释器的设置中:

  • src为源内容根:

                           

  • 然后确保将添加源添加到您的 PYTHONPATH

  • 现在将解决进口问题:

                     

这样,您可以将任何所需的内容添加为源根,一切将简单地进行。但是,如果未将其标记为源根,则会出现错误:

                                 

毕竟,别忘了重新启动。在PyCharm菜单中,选择:文件->使缓存无效/重新启动

Manually adding it as you have done is indeed one way of doing this, but there is a simpler method, and that is by simply telling pycharm that you want to add the src folder as a source root, and then adding the sources root to your python path.

This way, you don’t have to hard code things into your interpreter’s settings:

  • Add src as a source content root:

                           

  • Then make sure to add add sources to your PYTHONPATH:

  • Now imports will be resolved:

                     

This way, you can add whatever you want as a source root, and things will simply work. If you unmarked it as a source root however, you will get an error:

                                 

After all this don’t forget to restart. In PyCharm menu select: File –> Invalidate Caches / Restart


回答 1

  1. 检查__init__.py文件src夹文件
  2. 添加 src文件夹为源根
  3. 然后确保将添加源添加到您的 PYTHONPATH(见上文)
  4. 在PyCharm菜单中选择:File-> Invalidate Caches / Restart
  1. check for __init__.py file in src folder
  2. add the src folder as a source root
  3. Then make sure to add add sources to your PYTHONPATH (see above)
  4. in PyCharm menu select: File –> Invalidate Caches / Restart

回答 2

如果有人还在看,我尝试使用PyCharm 2016.3时,可接受的答案仍然有效。用户界面可能已更改,但选项仍然相同。

即。右键单击您的根文件夹->“标记目录为”->源根

If anyone is still looking at this, the accepted answer still works for PyCharm 2016.3 when I tried it. The UI might have changed, but the options are still the same.

ie. Right click on your root folder –> ‘Mark Directory As’ –> Source Root


回答 3

测试完所有变通办法之后,建议您Settings -> Project -> project dependencies重新看看并重新安排它们。

After testing all workarounds, i suggest you to take a look at Settings -> Project -> project dependencies and re-arrange them.


回答 4

通常,$ PYTHONPATH用于教python解释器查找必要的模块。PyCharm需要在“首选项”中添加路径。


回答 5

通常,这是缺少包装的问题,只需将插入号放在未解决的参考上并按Alt+Enter以显示选项,那么您应该知道如何解决。

Generally, this is a missing package problem, just place the caret at the unresolved reference and press Alt+Enter to reveal the options, then you should know how to solve it.


回答 6

遵循接受的答案后,请执行以下操作为我解决此问题:

File→交通Settings→交通Project <your directory/project>→交通Project Dependencies

选择您的未解析导入文件所在的目录/项目,并选中相应的框以告知Pycharm该项目取决于您的其他项目。

我的文件夹层次结构与问题中的文件夹层次结构略有不同。我的就是这样

├── MyDirectory  
     └── simulate.py  
├── src  
     ├── networkAlgorithm.py  
     ├── ...

告诉Pycharm src依赖于MyDirectory我,此问题已解决!

After following the accepted answer, doing the following solved it for me:

FileSettingsProject <your directory/project>Project Dependencies

Chose the directory/project where your file that has unresolved imports resides and check the box to tell Pycharm that that project depends on your other project.

My folder hierarcy is slightly different from the one in the question. Mine is like this

├── MyDirectory  
│     └── simulate.py  
├── src  
│     ├── networkAlgorithm.py  
│     ├── ...

Telling Pycharm that src depends on MyDirectory solved the issue for me!


回答 7

尽管所有答案都确实有帮助,但是应该明确解释其中一小部分信息:

  • 本质上,具有多个分层目录的项目将作为具有某些属性的包来工作。
  • 要导入本地创建的自定义类,我们需要导航到包含.py文件的目录并创建一个__init__.py(空)文件。

之所以有帮助,是因为该文件是使Python将目录视为包含包所必需的。干杯!

Although all the answers are really helpful, there’s one tiny piece of information that should be explained explicitly:

  • Essentially, a project with multiple hierarchical directories work as a package with some attributes.
  • To import custom local created Classes, we need to navigate to the directory containing .py file and create an __init__.py (empty) file there.

Why this helps is because this file is required to make Python treat the directory as containing packages. Cheers!


回答 8

通过PyCharm安装(与Community Edition一起使用)。打开,Settings > Project > Project Interpreter然后单击下面的屏幕快照中的绿色+图标。在打开的第二个对话框中,输入软件包名称,然后单击“安装软件包”按钮。

Install via PyCharm (works with Community Edition). Open up Settings > Project > Project Interpreter then click the green + icon in the screenshot below. In the 2nd dialogue that opens, enter the package name and click the ‘Install Package’ button.


回答 9

很多时候发生的事情是没有安装插件。例如

如果您正在开发django项目,并且在pyCharm中未安装django插件,则会显示错误“未解决的引用”。请参阅:https : //www.jetbrains.com/pycharm/help/resolving-references.html

Many a times what happens is that the plugin is not installed. e.g.

If you are developing a django project and you do not have django plugin installed in pyCharm, it says error ‘unresolved reference’. Refer: https://www.jetbrains.com/pycharm/help/resolving-references.html


回答 10

请检查您是否使用了正确的解释器。我遇到错误“无法解析的参考’django’”以解决此问题,我从项目设置中更改了项目解释器(将Python 3更改为Python 2.7):选择项目,转到文件->设置->项目:->项目解释器->浏览并选择正确的版本或解释器(例如/usr/bin/python2.7)。

Please check if you are using the right interpreter that you are supposed to. I was getting error “unresolved reference ‘django’ ” to solve this I changed Project Interpreter (Changed Python 3 to Python 2.7) from project settings: Select Project, go to File -> Settings -> Project: -> Project Interpreter -> Brows and Select correct version or Interpreter (e.g /usr/bin/python2.7).


回答 11

就我而言,问题是我正在使用 Virtual environment是无法访问全局站点程序包的。因此,解释器不知道新安装的软件包。

要解决此问题,只需编辑或重新创建您的虚拟解释器,然后勾选该Inherit global site-packages选项。

In my case the problem was I was using Virtual environment which didn’t have access to global site-packages. Thus, the interpreter was not aware of the newly installed packages.

To resolve the issue, just edit or recreate your virtual interpreter and tick the Inherit global site-packages option.


回答 12

这为我工作: Top Menu -> File -> Invalidate Caches/Restart

This worked for me: Top Menu -> File -> Invalidate Caches/Restart


回答 13

在PyCharm 2019.3.1中完成。 右键单击src文件夹->“标记目录为”->单击“排除”,您的src文件夹应为蓝色。

Done in PyCharm 2019.3.1 Right-click on your src folder -> “Mark Directory as” -> Click-on “Excluded” and your src folder should be blue.


回答 14

Pycharm使用venv。在venv的控制台中,您应该显式安装软件包或进入settings -> project interpreter -> add interpreter -> inherit global site-packages

Pycharm uses venv. In the venv’s console you should install the packages explicitly or go in settings -> project interpreter -> add interpreter -> inherit global site-packages.


回答 15

在较新版本的pycharm中,您可以简单地执行以下操作:右键单击要从中导入文件的目录或python包,然后单击“将目录标记为”->“源根”

In newer versions of pycharm u can do simply by right clicking on the directory or python package from which you want to import a file, then click on ‘Mark Directory As’ -> ‘Sources Root’


回答 16

解决此问题的最简单方法是在pyCharm软件中执行以下操作:

单击:文件>设置>(项目:您的项目名称)>项目解释器>

然后单击右侧的“ +”图标以搜索所需的软件包并安装。

享受编码!

The easiest way to fix it is by doing the following in your pyCharm software:

Click on: File > Settings > (Project: your project name) > Project Interpreter >

then click on the “+” icon on the right side to search for the package you want and install it.

Enjoy coding !!!


Python使用哪种IDE?[关闭]

问题:Python使用哪种IDE?[关闭]

其他人使用哪些IDE(“ GUI /编辑器”)进行Python编码?

What IDEs (“GUIs/editors”) do others use for Python coding?


回答 0

结果

电子表格版本

或者,以纯文本格式:(也可以作为aa 屏幕截图获得

                         Bracket Matching -.  .- Line Numbering
                          Smart Indent -.  |  |  .- UML Editing / Viewing
         Source Control Integration -.  |  |  |  |  .- Code Folding
                    Error Markup -.  |  |  |  |  |  |  .- Code Templates
  Integrated Python Debugging -.  |  |  |  |  |  |  |  |  .- Unit Testing
    Multi-Language Support -.  |  |  |  |  |  |  |  |  |  |  .- GUI Designer (Qt, Eric, etc)
   Auto Code Completion -.  |  |  |  |  |  |  |  |  |  |  |  |  .- Integrated DB Support
     Commercial/Free -.  |  |  |  |  |  |  |  |  |  |  |  |  |  |  .- Refactoring
   Cross Platform -.  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |     
                  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Atom              |Y |F |Y |Y*|Y |Y |Y |Y |Y |Y |  |Y |Y |  |  |  |  |*many plugins
Editra            |Y |F |Y |Y |  |  |Y |Y |Y |Y |  |Y |  |  |  |  |  |
Emacs             |Y |F |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |  |  |  |
Eric Ide          |Y |F |Y |  |Y |Y |  |Y |  |Y |  |Y |  |Y |  |  |  |
Geany             |Y |F |Y*|Y |  |  |  |Y |Y |Y |  |Y |  |  |  |  |  |*very limited
Gedit             |Y |F |Y¹|Y |  |  |  |Y |Y |Y |  |  |Y²|  |  |  |  |¹with plugin; ²sort of
Idle              |Y |F |Y |  |Y |  |  |Y |Y |  |  |  |  |  |  |  |  |
IntelliJ          |Y |CF|Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |
JEdit             |Y |F |  |Y |  |  |  |  |Y |Y |  |Y |  |  |  |  |  |
KDevelop          |Y |F |Y*|Y |  |  |Y |Y |Y |Y |  |Y |  |  |  |  |  |*no type inference
Komodo            |Y |CF|Y |Y |Y |Y |Y |Y |Y |Y |  |Y |Y |Y |  |Y |  |
NetBeans*         |Y |F |Y |Y |Y |  |Y |Y |Y |Y |Y |Y |Y |Y |  |  |Y |*pre-v7.0
Notepad++         |W |F |Y |Y |  |Y*|Y*|Y*|Y |Y |  |Y |Y*|  |  |  |  |*with plugin
Pfaide            |W |C |Y |Y |  |  |  |Y |Y |Y |  |Y |Y |  |  |  |  |
PIDA              |LW|F |Y |Y |  |  |  |Y |Y |Y |  |Y |  |  |  |  |  |VIM based
PTVS              |W |F |Y |Y |Y |Y |Y |Y |Y |Y |  |Y |  |  |Y*|  |Y |*WPF bsed
PyCharm           |Y |CF|Y |Y*|Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |*JavaScript
PyDev (Eclipse)   |Y |F |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |  |  |  |
PyScripter        |W |F |Y |  |Y |Y |  |Y |Y |Y |  |Y |Y |Y |  |  |  |
PythonWin         |W |F |Y |  |Y |  |  |Y |Y |  |  |Y |  |  |  |  |  |
SciTE             |Y |F¹|  |Y |  |Y |  |Y |Y |Y |  |Y |Y |  |  |  |  |¹Mac version is
ScriptDev         |W |C |Y |Y |Y |Y |  |Y |Y |Y |  |Y |Y |  |  |  |  |    commercial
Spyder            |Y |F |Y |  |Y |Y |  |Y |Y |Y |  |  |  |  |  |  |  |
Sublime Text      |Y |CF|Y |Y |  |Y |Y |Y |Y |Y |  |Y |Y |Y*|  |  |  |extensible w/Python,
TextMate          |M |F |  |Y |  |  |Y |Y |Y |Y |  |Y |Y |  |  |  |  |    *PythonTestRunner
UliPad            |Y |F |Y |Y |Y |  |  |Y |Y |  |  |  |Y |Y |  |  |  |
Vim               |Y |F |Y |Y |Y |Y |Y |Y |Y |Y |  |Y |Y |Y |  |  |  |
Visual Studio     |W |CF|Y |Y |Y |Y |Y |Y |Y |Y |? |Y |? |? |Y |? |Y |
Visual Studio Code|Y |F |Y |Y |Y |Y |Y |Y |Y |Y |? |Y |? |? |? |? |Y |uses plugins
WingIde           |Y |C |Y |Y*|Y |Y |Y |Y |Y |Y |  |Y |Y |Y |  |  |  |*support for C
Zeus              |W |C |  |  |  |  |Y |Y |Y |Y |  |Y |Y |  |  |  |  |
                  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
   Cross Platform -'  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |     
     Commercial/Free -'  |  |  |  |  |  |  |  |  |  |  |  |  |  |  '- Refactoring
   Auto Code Completion -'  |  |  |  |  |  |  |  |  |  |  |  |  '- Integrated DB Support
    Multi-Language Support -'  |  |  |  |  |  |  |  |  |  |  '- GUI Designer (Qt, Eric, etc)
  Integrated Python Debugging -'  |  |  |  |  |  |  |  |  '- Unit Testing
                    Error Markup -'  |  |  |  |  |  |  '- Code Templates
         Source Control Integration -'  |  |  |  |  '- Code Folding
                          Smart Indent -'  |  |  '- UML Editing / Viewing
                         Bracket Matching -'  '- Line Numbering

缩略语:

 L  - Linux
 W  - Windows
 M  - Mac
 C  - Commercial
 F  - Free
 CF - Commercial with Free limited edition
 ?  - To be confirmed

我没有提到语法高亮之类的基础知识,因为我期望默认情况下这些。


这只是一份反映您的反馈和评论的清单,我不主张使用这些工具。当您继续发布答案时,我将不断更新此列表。

PS。您能帮我将上述编辑器的功能添加到列表中吗(例如自动完成,调试等)?

对于这个问题,我们有一个综合的Wiki页面https://wiki.python.org/moin/IntegratedDevelopmentEnvironments

将修改提交到电子表格

Results

Spreadsheet version

Alternatively, in plain text: (also available as a a screenshot)

                         Bracket Matching -.  .- Line Numbering
                          Smart Indent -.  |  |  .- UML Editing / Viewing
         Source Control Integration -.  |  |  |  |  .- Code Folding
                    Error Markup -.  |  |  |  |  |  |  .- Code Templates
  Integrated Python Debugging -.  |  |  |  |  |  |  |  |  .- Unit Testing
    Multi-Language Support -.  |  |  |  |  |  |  |  |  |  |  .- GUI Designer (Qt, Eric, etc)
   Auto Code Completion -.  |  |  |  |  |  |  |  |  |  |  |  |  .- Integrated DB Support
     Commercial/Free -.  |  |  |  |  |  |  |  |  |  |  |  |  |  |  .- Refactoring
   Cross Platform -.  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |     
                  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Atom              |Y |F |Y |Y*|Y |Y |Y |Y |Y |Y |  |Y |Y |  |  |  |  |*many plugins
Editra            |Y |F |Y |Y |  |  |Y |Y |Y |Y |  |Y |  |  |  |  |  |
Emacs             |Y |F |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |  |  |  |
Eric Ide          |Y |F |Y |  |Y |Y |  |Y |  |Y |  |Y |  |Y |  |  |  |
Geany             |Y |F |Y*|Y |  |  |  |Y |Y |Y |  |Y |  |  |  |  |  |*very limited
Gedit             |Y |F |Y¹|Y |  |  |  |Y |Y |Y |  |  |Y²|  |  |  |  |¹with plugin; ²sort of
Idle              |Y |F |Y |  |Y |  |  |Y |Y |  |  |  |  |  |  |  |  |
IntelliJ          |Y |CF|Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |
JEdit             |Y |F |  |Y |  |  |  |  |Y |Y |  |Y |  |  |  |  |  |
KDevelop          |Y |F |Y*|Y |  |  |Y |Y |Y |Y |  |Y |  |  |  |  |  |*no type inference
Komodo            |Y |CF|Y |Y |Y |Y |Y |Y |Y |Y |  |Y |Y |Y |  |Y |  |
NetBeans*         |Y |F |Y |Y |Y |  |Y |Y |Y |Y |Y |Y |Y |Y |  |  |Y |*pre-v7.0
Notepad++         |W |F |Y |Y |  |Y*|Y*|Y*|Y |Y |  |Y |Y*|  |  |  |  |*with plugin
Pfaide            |W |C |Y |Y |  |  |  |Y |Y |Y |  |Y |Y |  |  |  |  |
PIDA              |LW|F |Y |Y |  |  |  |Y |Y |Y |  |Y |  |  |  |  |  |VIM based
PTVS              |W |F |Y |Y |Y |Y |Y |Y |Y |Y |  |Y |  |  |Y*|  |Y |*WPF bsed
PyCharm           |Y |CF|Y |Y*|Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |*JavaScript
PyDev (Eclipse)   |Y |F |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |  |  |  |
PyScripter        |W |F |Y |  |Y |Y |  |Y |Y |Y |  |Y |Y |Y |  |  |  |
PythonWin         |W |F |Y |  |Y |  |  |Y |Y |  |  |Y |  |  |  |  |  |
SciTE             |Y |F¹|  |Y |  |Y |  |Y |Y |Y |  |Y |Y |  |  |  |  |¹Mac version is
ScriptDev         |W |C |Y |Y |Y |Y |  |Y |Y |Y |  |Y |Y |  |  |  |  |    commercial
Spyder            |Y |F |Y |  |Y |Y |  |Y |Y |Y |  |  |  |  |  |  |  |
Sublime Text      |Y |CF|Y |Y |  |Y |Y |Y |Y |Y |  |Y |Y |Y*|  |  |  |extensible w/Python,
TextMate          |M |F |  |Y |  |  |Y |Y |Y |Y |  |Y |Y |  |  |  |  |    *PythonTestRunner
UliPad            |Y |F |Y |Y |Y |  |  |Y |Y |  |  |  |Y |Y |  |  |  |
Vim               |Y |F |Y |Y |Y |Y |Y |Y |Y |Y |  |Y |Y |Y |  |  |  |
Visual Studio     |W |CF|Y |Y |Y |Y |Y |Y |Y |Y |? |Y |? |? |Y |? |Y |
Visual Studio Code|Y |F |Y |Y |Y |Y |Y |Y |Y |Y |? |Y |? |? |? |? |Y |uses plugins
WingIde           |Y |C |Y |Y*|Y |Y |Y |Y |Y |Y |  |Y |Y |Y |  |  |  |*support for C
Zeus              |W |C |  |  |  |  |Y |Y |Y |Y |  |Y |Y |  |  |  |  |
                  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
   Cross Platform -'  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |     
     Commercial/Free -'  |  |  |  |  |  |  |  |  |  |  |  |  |  |  '- Refactoring
   Auto Code Completion -'  |  |  |  |  |  |  |  |  |  |  |  |  '- Integrated DB Support
    Multi-Language Support -'  |  |  |  |  |  |  |  |  |  |  '- GUI Designer (Qt, Eric, etc)
  Integrated Python Debugging -'  |  |  |  |  |  |  |  |  '- Unit Testing
                    Error Markup -'  |  |  |  |  |  |  '- Code Templates
         Source Control Integration -'  |  |  |  |  '- Code Folding
                          Smart Indent -'  |  |  '- UML Editing / Viewing
                         Bracket Matching -'  '- Line Numbering

Acronyms used:

 L  - Linux
 W  - Windows
 M  - Mac
 C  - Commercial
 F  - Free
 CF - Commercial with Free limited edition
 ?  - To be confirmed

I don’t mention basics like syntax highlighting as I expect these by default.


This is a just dry list reflecting your feedback and comments, I am not advocating any of these tools. I will keep updating this list as you keep posting your answers.

PS. Can you help me to add features of the above editors to the list (like auto-complete, debugging, etc.)?

We have a comprehensive wiki page for this question https://wiki.python.org/moin/IntegratedDevelopmentEnvironments

Submit edits to the spreadsheet