admin管理员组

文章数量:1658064

NOTE:本文由赤石俊哉原创,您可以自由转载本文,并且在转载时进行不改变原文意思的删改。但转载时请通知作者(可以通过本页的评论,或者发送站内信)。

导言

最近开始有意愿学习一门新语言了,那就是一直想学但是没时间接触的Python。Python和Ruby有很多的相似之处,因为有Ruby的基础,感觉Python并不难。只是Python的格式限制的比较死,虽然我用其他语言写代码的时候,也会很注意格式(其实就是乱写一通之后,CTRL+K,CTRL+D)。那在开始学习之前,肯定是要选一个IDE咯。当然我的首选肯定是Visual Studio加上Python Tools for Visual Studio 扩展,这种配置在此我并不想展开了说,因为对于初学者来说,还是找个更加轻量级的IDE会好点(至少比VS轻量)。毕竟如果只是为了学习Python而安装VS那么太浪费了,像我日常使用的就是VS,而要添加Python的扩展,那就方便了。
但是我也不能说我写的这篇文章多么专业,做什么评测之类的,毕竟我才学尚浅。

前言

在开始使用之前,先来看看两个IDE的背景吧。

PyCharm的背景

PyCharm官网
PyCharm是JetBrains出的面向Python的IDE,说到JetBrains可能大家都不会陌生。在我们使用Visual Studio的时候,常用的一个扩展ReSharper就是JetBrains的产品。JB家族其他的产品还有Android Studio,WebStorm等等。对于使用过这些IDE的人来说,PyCharm应该是一个不错的选择。
PyCharm提供不是免费使用的专业版,按照JetBrains的授权方法,我们学生是可以拿到一年的教育版授权的,每年需要更新一次授权。
同时也提供免费授权使用的社区版。

PythonWin的背景

PythonWin项目
PythonWin相比PyCharm要更加轻量一些,功能少,体积小,免费。
此项目最后更新时间(截止2016年1月7日)2014年5月4日。

安装

PyCharm的安装

对于PyCharm的安装,我将会以两种不同的形式来讲解,一边是已经拥有了Intellij Idea,希望为Idea添加Python扩展的用户,另一边则是希望安装完整地PyCharm的用户。
两者有什么区别呢?让我看看官方的说明吧。

Q: With the announcement of PyCharm will the IDEA plugin still be available?
A: Yes, we plan to release new PyCharm builds and plugin updates synchronously. The plugin will remain free for those who have purchased a IntelliJ IDEA Ultimate license.
问:随着PyCharm的发布,IDEA的插件是否可以继续使用呢?
答:是的,我们会同步发布新版本的PyCharm和插件更新。插件仍然会对购买了IntelliJ IDEA旗舰版的用户免费。

Q: Will the plugin support most/all of the features PyCharm supports?
A: The Python plugin for IntelliJ IDEA is built from the same codebase as PyCharm. Some features may be temporary not available in the plugin because the latest available IntelliJ IDEA bases on an earlier IntelliJ platform compared to PyCharm.
问:插件是否支持大部分或者全部的PyCharm特性?
答:IntelliJ IDEA的Python插件是使用和PyCharm完全一样的基础代码来构建的。插件中有些特性可能暂时无法使用因为最新的IntelliJ IDEA比PyCharm可能前者使用了较早的IntelliJ平台。

Q: What is the differences between PyCharm and the Python plugin. Will there be advantages to using PyCharm instead of just the plugin?
A: PyCharm offers a simpler UI in a number of areas such as project management, IDE settings etc.
The Python plugin, in its turn, has the full range of Jython support features (cross-language navigation, completion and refactoring). PyCharm only supports Jython as the runtime for running applications.
If you’re not using the Java/Python integration, PyCharm is a better place to start.
问:PyCharm和Python插件有何不同?使用PyCharm会比使用插件更好吗?
答:在很多区域中,比如工程管理,IDE设置等之中,PyCharm提供了一个更简单的UI。
Python插件完全支持Jython的特性(跨语向导,完成和重构)。PyCharm只能支持Jython作为运行时来运行应用程序。
如果你不需要使用Java/Python继承环境,使用PyCharm入门将是一个很好的选择。

Q: Can I use PyCharm with my IntelliJ IDEA license?
A: No. The two products use separate licensing systems; you need to buy two licenses if you would like to use both products.
问:我可以使用IntelliJ IDEA的授权来使用PyCharm嘛?
答:不可以,这两个产品使用了分别地授权系统,如果你希望同时使用两者的话,需要购买两份授权。

Q: Are the project files compatible between IntelliJ IDEA and PyCharm?
A: Projects created in PyCharm can be opened in IntelliJ IDEA with Python plugin installed without any issues. IntelliJ IDEA allows a more flexible project configuration, such as the possibility to configure libraries for projects. PyCharm will be able to open and work with projects that use the more advanced settings, but you will not be able to change the settings in PyCharm.
问:IntelliJ IDEA的工程和PyCharm的工程文件是否是互相兼容的呢?
答:在PyCharm中创建的工程是可以在安装了Python插件的IntelliJ IDEA中毫无问题地打开的。IntelliJ IDEA允许有更多灵活的工程设置,比如可以设置工程的库。PyCharm可以打开使用那些更多高级设定的工程,但是在PyCharm你不能改变这些设定。

IntelliJ IDEA Python plugin

  • 首先,先启动Intellij IDEA。
  • 进入 Setting,从左边的标签中找到 Plugins。然后在右边的按钮中找到Browse respositories…
  • 搜索Python 找到Python的插件,点击Install。

    装完之后只看到了

PyCharm

从上面记载的PyCharm官网中下载最新版本的PyCharm Community,双击运行安装。

安装好之后直接运行

在新建工程时,可以选择使用哪一个解释器。

让我们尝试一下写一个Hello World吧,并运行。

大功告成~!

PythonWin

待追加

本文标签: 杂谈PythonWinpycharmIDEPython