安装python 和ide_Python IDE和代码编辑器(指南)

安装python 和ide

Writing Python using IDLE or the Python Shell is great for simple things, but those tools quickly turn larger programming projects into frustrating pits of despair. Using an IDE, or even just a good dedicated code editor, makes coding fun—but which one?

使用IDLE或Python Shell编写Python非常适合简单的事情,但是这些工具很快将大型编程项目变成令人沮丧的绝望之地。 使用IDE,甚至只是一个好的专用代码编辑器,都使编码变得有趣,但是哪一个呢?

Fear not, Gentle Reader! We are here to help explain and demystify the myriad of choices available to you. We can’t pick what works best for you and your process, but we can explain the pros and cons of each and help you make an informed decision.

不要害怕,温柔的读者! 我们在这里帮助您解释和消除无数可用的选择的神秘性。 我们无法选择最适合您和您的流程的方法,但是我们可以说明每种方法的优缺点,并帮助您做出明智的决定。

To make things easier, we’ll break our list into two broad categories tools—those built exclusive for Python development, and those built for general development we can use for Python. We’ll call out some Why’s and Why Not’s for each. Lastly, none of these are mutually exclusive, so you can try them out on your own with very little penalty.

为了使事情变得容易,我们将列表分为两大类:一类是专为Python开发而构建的工具,另一类是为Python可用于一般开发而构建的工具。 我们将为每个呼叫出一些“为什么”和“为什么不是”的信息。 最后,这些都不是互斥的,因此您可以自己尝试一下而不会付出任何代价。

But first…

但首先…

什么是IDE和代码编辑器? (What Is an IDE and a Code Editor?)

An IDE (or Integrated Development Environment) is a program dedicated to software development. As the name implies, IDEs integrate several tools specifically designed for software development. These tools usually include an editor tailored to handling code (for example, syntax highlighting and auto-completion); build, execution, and debugging tools; and some form of source control.

IDE(或集成开发环境)是专用于软件开发的程序。 顾名思义,IDE集成了多个专门为软件开发设计的工具。 这些工具通常包括专门用于处理代码的编辑器(例如,语法突出显示和自动完成); 构建,执行和调试工具; 以及某种形式的源代码控制。

Most IDEs support many different programming languages and contain many more features, and therefore can be large, take time to download and install, and require advanced knowledge to use properly.

大多数IDE支持许多不同的编程语言并包含更多功能,因此可能会很大,需要大量时间来下载和安装,并且需要高级知识才能正确使用。

In contrast, a dedicated code editor can be as simple as a text editor with syntax highlighting and code formatting capabilities. Most good code editors can execute code and control a debugger, and the very best interact with source control systems as well. Compared to an IDE, a good dedicated code editor is usually smaller and quicker, but often less feature rich.

相反,专用的代码编辑器可以像具有语法突出显示和代码格式化功能的文本编辑器一样简单。 大多数优秀的代码编辑器都可以执行代码并控制调试器,并且最好的编辑器还可以与源代码控制系统进行交互。 与IDE相比,一个好的专用代码编辑器通常更小,更快,但是功能丰富程度却通常较低。

良好的Python编码环境的要求 (Requirements for a Good Python Coding Environment)

So what things do we really need in a coding environment? Feature lists vary from app to app, but there are a core set of features which makes coding easier:

那么,在编码环境中我们真正需要什么呢? 功能列表因应用程序而异,但是有一组核心功能使编码更容易:

  • Save and reload code files If an IDE or editor won’t let you save your work and reopen everything later, in the same state it was in when you left, it’s not much of an IDE.
  • Run code from within the environment Similarly, if you have to drop out of the editor to run your Python code, then it’s not much more than a simple text editor.
  • Debugging support Being able to step through your code as it runs is a core feature of all IDEs and most good code editors.
  • Syntax highlighting Being able to quickly spot keywords, variables, and symbols on your code makes reading and understanding code much easier.
  • Automatic code formatting Any editor or IDE worth it’s salt will recognize the colon at the end of a while or for statement, and know the next line should be indented.
  • 保存并重新加载代码文件如果IDE或编辑器不允许您保存所做的工作并稍后重新打开所有内容(处于离开时的状态),则IDE的意义不大。
  • 在环境中运行代码同样,如果您必须退出编辑器以运行Python代码,那么它就不只是一个简单的文本编辑器。
  • 调试支持能够逐步执行代码,这是所有IDE和大多数优秀代码编辑器的核心功能。
  • 语法突出显示能够快速发现代码中的关键字,变量和符号,使阅读和理解代码变得更加容易。
  • 自动代码格式化任何值得考虑的编辑器或IDE都会在whilefor语句结束时识别冒号,并知道应该缩进下一行。

Of course, there are lots of other feaures you might want (like source code control, an extension model, build and test tools, language help, etc.), but they work work support the core features.

当然,您可能还需要其他许多功能(例如源代码控制,扩展模型,构建和测试工具,语言帮助等),但是它们可以正常工作以支持核心功能。

With these features in mind, let’s take a look at some general purpose tools we can use for Python development.

考虑到这些功能,让我们看一些可用于Python开发的通用工具。

具有Python支持的常规编辑器和IDE (General Editors and IDEs With Python Support)

Eclipse + PyDev (Eclipse + PyDev)

Category: IDEWebsite: www.eclipse.orgPython tools: PyDev, www.pydev.org

类别: IDE 网站: www.eclipse.org Python工具: PyDev, www.pydev.org

If you’ve spent any amount of time in the open-source community, you’ve heard about Eclipse. Available for Linux, Windows, and OS X at, Eclipse the de facto open-source IDE for Java development. It has a rich marketplace of extensions and add-ons, which makes Eclipse useful for a wide range of development activities.

如果您在开源社区中度过了很多时间,那么您已经听说过Eclipse。 Eclipse(可用于Java开发的事实上的开源IDE)可用于Linux,Windows和OSX。 它具有丰富的扩展和附加产品市场,这使得Eclipse在广泛的开发活动中很有用。

One such extension is PyDev, which enables Python debugging, code completion, and an interactive Python console. Installing PyDev into Eclipse is easy—from Eclipse, select Help, Eclipse Marketplace, then search for PyDev. Click Install, and restart Eclipse if necessary.

PyDev是这样的扩展之一,它可以进行Python调试,代码完成和交互式Python控制台。 将PyDev安装到Eclipse中很容易-从Eclipse中选择“帮助”,然后选择Eclipse Marketplace,然后搜索PyDev。 单击安装,然后根据需要重新启动Eclipse。

Eclipse with PyDev installed

Why: If you’ve already got Eclipse installed, adding PyDev is quick and easy. The learning curve for PyDev is non-existant for the experienced Eclipse developer.

原因:如果您已经安装了Eclipse,则添加PyDev既快捷又容易。 经验丰富的Eclipse开发人员不存在PyDev的学习曲线。

Why Not: If you’re just starting out with Python, or with software development in general, Eclipse can be a lot to handle. Remember when I said IDEs are larger and need more knowledge to use properly? Eclipse is all that and a bag of (micro)chips.

为什么不这样做:如果您只是刚开始使用Python或一般的软件开发,那么Eclipse可以处理很多事情。 还记得我说过IDE更大并且需要更多知识才能正确使用吗? Eclipse就是全部,还有一袋(微)芯片。

崇高文字 (Sublime Text)

Category: Code EditorWebsite: http://www.sublimetext.com

类别:代码编辑器网站: http : //www.sublimetext.com

Written by a Google engineer with a dream for a better text editor, Sublime Text is an extremely popular code editor. Supported on all platforms, Sublime Text has built in support for Python code editing, and a rich set of extensions (called packages) which extend the syntax and editing features.

Sublime Text由Google工程师撰写,梦想着有一个更好的文本编辑器,是一个非常受欢迎的代码编辑器。 在所有平台上都受支持的Sublime Text内置了对Python代码编辑的支持,以及丰富的扩展集(称为包),这些扩展了语法和编辑功能。

Installing additional Python packages can be tricky – all Sublime Text packages are written in Python itself, and installing community packages often require you to execute Python scripts directly in Sublime Text.

安装其他Python软件包可能很棘手-所有Sublime Text软件包都是用Python本身编写的,而安装社区软件包通常需要您直接在Sublime Text中执行Python脚本。

Sublime Text code editor

WHY Sublime Text has a great following in the community. As a code editor, alone, Sublime Text is fast, small, and well supported.

为什么 Sublime Text在社区中拥有大量追随者。 仅作为代码编辑器,Sublime Text速度快,体积小且得到了很好的支持。

WHY NOT Sublime Text is not free, although you can use the evaluation version for an indefinite period of time. Installing extensions can be tricky, and there’s no direct support for executing or debugging code from within the editor.

为什么不是 Sublime Text不是免费的,尽管您可以无限期地使用评估版。 安装扩展可能很棘手,并且不直接支持在编辑器中执行或调试代码。

To make the most of your Sublime Text setup, read our Python + Sublime Text setup guide and consider our in-depth video course that shows you how to craft an effective Python development setup with Sublime Text 3.

要充分利用Sublime Text设置,请阅读我们的Python + Sublime Text设置指南,并考虑我们的深入视频课程 ,该课程向您展示如何使用Sublime Text 3编写有效的Python开发设置。

原子 (Atom)

Category: Code EditorWebsite: https://atom.io/

类别:代码编辑器网站: https : //atom.io/

Available on all platforms, Atom is billed as the “hackable text editor for the 21st Century”. With a sleek interface, file system browser, and marketplace for extensions, open-source Atom is built using Electron, a framework for creating desktop applications using JavaScript, HTML, and CSS. Python language support is provided by an extension which can installed when Atom is running.

Atom在所有平台上都可用,被誉为“ 21世纪可入侵的文本编辑器”。 凭借时尚的界面,文件系统浏览器和扩展市场,开源的Atom使用Electron构建, Electron是使用JavaScript,HTML和CSS创建桌面应用程序的框架。 扩展提供了Python语言支持,该扩展可以在Atom运行时安装。

Atom code editor

WHY Broad support on all platforms, thanks to Electron. Atom is small, and downloads and loads fast.

为何要感谢所有电子平台的广泛支持。 Atom很小,并且下载和加载速度很快。

WHY NOT Build and debugging support aren’t built-in, but are community provided add-ons. Because Atom is built on Electron, it’s always running in a JavaScript process, and not as a native application.

为什么不建立和调试支持不是内置的,而是社区提供的附加组件。 由于Atom基于Electron构建,因此它始终在JavaScript进程中运行,而不是作为本机应用程序运行。

GNU Emacs (GNU Emacs)

Category: Code EditorWebsite: https://www.gnu.org/software/emacs/

类别:代码编辑器网站: https : //www.gnu.org/software/emacs/

Back before the iPhone vs Android war, before the Linux vs Windows war, even before PC vs Mac war, there was the Editor War, with GNU Emacs as one of the combatants. Billed as “the extensible, customizable, self-documenting, real-time display editor”, GNU Emacs has been around almost as long as UNIX, and has a fervent following.

早在iPhone与Android战争之前,在Linux与Windows战争之前,甚至在PC与Mac战争之前,就发生了编辑战争 ,其中GNU Emacs是其中的一员。 GNU Emacs被称为“可扩展的,可定制的,自文档的,实时显示编辑器”,它的历史几乎与UNIX差不多,并且拥有大量的追随者。

Always free and available on every platform (in one form or another), GNU Emacs uses a form of the powerful Lisp programming language for customization, and various customization scripts exist for Python development.

GNU Emacs始终免费且可在每个平台上使用(一种形式或另一种形式),它使用一种强大的Lisp编程语言进行自定义,并且存在用于Python开发的各种自定义脚本。

GNU Emacs editor

WHY You know Emacs, you use Emacs, you love Emacs. Lisp is a second language, and you know the power it gives you means you can do anything.

为什么您知道Emacs,您使用Emacs,您喜欢Emacs。 Lisp是第二种语言,您知道它给您的力量意味着您可以做任何事情。

WHY NOT Customization means writing (or copy/pasting) Lisp code into various script files. If it’s not already provided, you may have to learn Lisp to figure out how to do it.

为什么不进行定制意味着将Lisp代码写入(或复制/粘贴)到各种脚本文件中。 如果尚未提供,则可能必须学习Lisp才能弄清楚该如何做。

Plus, you know that Emacs would be a great operating system, if it only had a good text editor…

另外,您知道Emacs如果只有一个好的文本编辑器,它将是一个很好的操作系统…

Be sure to consult our Python + Emacs setup guide to make the most of this setup.

请务必参考我们的Python + Emacs设置指南,以充分利用此设置。

VI / VIM (VI/VIM)

Category: Code EditorWebsite: https://www.vim.org/

类别:代码编辑器网站: https : //www.vim.org/

On the other side of the Text Editor War sits VI (aka VIM). Included by default on almost every UNIX system and Mac OS X, VI has an equally fervent following. VI and VIM are modal editors, separating the viewing of a file from the editing of a file. VIM includes many improvements on the original VI, including an extensibility model and in-place code building. VIMScripts are available for various Python development tasks.

文本编辑器War的另一端是VI(又称VIM)。 默认情况下,几乎所有UNIX系统和Mac OS X都包含VI。 VI和VIM是模态编辑器,将文件的查看与文件的编辑分开。 VIM对原始VI进行了许多改进,包括可扩展性模型和就地代码构建。 VIMScripts可用于各种Python开发任务。

VIM text editor

WHY You know VI, you use VI, you love VI. VIMScripts don’t scare you, and you know you bend it to your will.

为什么您知道VI,您使用VI,您爱VI。 VIMScripts不会吓到您,您知道您会随心所欲。

WHY NOT Like Emacs, you’re not comfortable finding or writing your own scripts to enable Python development, and your’re not sure how a modal editor is supposed to work.

为什么不像Emacs那样,您不舒服地查找或编写自己的脚本来启用Python开发,并且不确定模态编辑器应该如何工作。

Plus, you know that VI would be a great text editor, if only it had a decent operating system.

另外,您知道,如果VI具有一个不错的操作系统,它将是一个很好的文本编辑器。

If you’re going with this combination, check out our Python + VIM setup guide with tips and plugin recommendations.

如果您要使用这种组合,请查看我们的Python + VIM设置指南,其中包含提示和插件建议。

视觉工作室 (Visual Studio)

Category: IDEWebsite: https://www.visualstudio.com/vs/Python tools: Python Tools for Visual Studio, aka PVTS

类别: IDE 网站: https : //www.visualstudio.com/vs/ Python工具: 适用于Visual Studio的Python工具 ,又名PVTS

Built by Microsoft, Visual Studio is a full-featured IDE, in many ways comparable to Eclipse. Built for Windows and Mac OS only, VS comes in both free (Community) and paid (Professional and Enterprise) versions. Visual Studio enables development for a variety of platforms, and comes with it’s own marketplace for extensions.

Visual Studio由Microsoft构建,是功能齐全的IDE,在许多方面都可以与Eclipse媲美。 VS仅针对Windows和Mac OS构建,具有免费(社区)和付费(专业版和企业版)两种版本。 Visual Studio支持各种平台的开发,并带有自己的扩展市场。

Python Tools for Visual Studio (aka PTVS) enables Python coding in Visual Studio, and enables Intellisense for Python, debugging, and other tools.

用于Visual Studio的Python工具(又名PTVS)在Visual Studio中启用Python编码,并为Python,调试和其他工具启用Intellisense。

WHY Like Eclipse, if you already have Visual Studio installed for other development activities, adding PTVS is quick and easy.

为何与Eclipse一样,如果您已经为其他开发活动安装了Visual Studio,则添加PTVS既快速又容易。

WHY NOT Just like Eclipse, Visual Studio is a big download for just Python. Plus, if you’re on Linux, you’re out of luck – there is no Visual Studio install for that platform.

为什么不像Eclipse一样,Visual Studio只是Python的一大下载。 另外,如果您使用的是Linux,那么您就不走运了–该平台没有安装Visual Studio。

Visual Studio程式码 (Visual Studio Code)

Not to be confused with full Visual Studio, Visual Studio Code (aka VS Code) is a full-featured code editor available for Linux, Mac OS X, and Windows platforms. Small and light-weight, but full-featured, VS Code is open-source, extensible, and configurable for almost any task. Like Atom, VS Code is built on Electron, so it has the same advantages and disadvantages that brings.

不要与完整的Visual Studio混淆,Visual Studio Code(又称VS Code)是功能齐全的代码编辑器,可用于Linux,Mac OS X和Windows平台。 VS Code体积小,重量轻,但功能齐全,它是开源的可扩展的 ,并且可针对几乎所有任务进行配置。 像Atom一样,VS Code是建立在Electron之上的,因此它具有相同的优点和缺点。

Installing Python support in VS Code is very easy – the Marketplace is a quick button click away. Search for Python, click Install, and restart if necessary. VS Code will recognize your Python installation and libraries automatically.

在VS Code中安装Python支持非常容易-只需单击一下即可快速到达Marketplace。 搜索Python,单击“安装”,然后在必要时重新启动。 VS Code将自动识别您的Python安装和库。

Visual Studio Code editor

WHY Thanks to Electron, VS Code is available on every platform, surprisingly full-featured despite having a small footprint, and open-source.

为什么要感谢Electron,VS Code可以在每个平台上使用,尽管占用空间小,但功能却令人惊讶,并且是开源的。

WHY NOT Electron means VS Code is not a native app. Plus, some people may have principled reasons to not use Microsoft resources.

为什么不使用 Electron表示VS Code不是本机应用程序。 另外,某些人可能有原则上的理由不使用Microsoft资源。

特定于Python的编辑器和IDE (Python Specific Editors and IDEs)

药香 (PyCharm)

Category: IDEWebsite: https://www.jetbrains.com/pycharm/

类别: IDE 网站: https : //www.jetbrains.com/pycharm/

One of the best (and only) full-featured, dedicated IDEs for Python is PyCharm. Available in both paid (Professional) and free open-source (Community) editions, PyCharm installs quickly and easily on Windows, Mac OS X, and Linux platforms.

PyCharm是最好的(也是唯一的)针对Python的全功能,专用IDE之一。 PyCharm提供付费版(专业版)和免费开源版(社区版),可在Windows,Mac OS X和Linux平台上快速轻松地安装。

Out of the box, PyCharm supports Python development directly – open a new file and start writing code. You can run and debug Python directly inside PyCharm, and it has support for source control and projects.

开箱即用,PyCharm直接支持Python开发–打开一个新文件并开始编写代码。 您可以直接在PyCharm中运行和调试Python,并且它支持源代码控制和项目。

PyCharm IDE for Python

WHY It’s the de facto Python IDE environment, with tons of support and a supportive community. It edits, runs, and debugs Python out of the box.

为什么这是事实上的Python IDE环境,拥有大量的支持和支持社区。 它可以直接编辑,运行和调试Python。

WHY NOT PyCharm can be slow to load, and the default settings may need tweaking for existing projects.

为什么不 PyCharm加载速度会很慢,并且默认设置可能需要对现有项目进行调整。

托尼 (Thonny)

Category: IDEWebsite: http://thonny.org/

类别: IDE 网站: http : //thonny.org/

A recent addition to the Python IDE family, Thonny is billed as an IDE for beginners. Written and maintained by the Institute of Computer Science at the University of Tartu in Estonia, Thonny is available for all major platforms, with installation instructions on the site.

Thonny是Python IDE系列的最新成员,被称为初学者的IDE。 Thonny由爱沙尼亚塔尔图大学 计算机科学学院撰写和维护,适用于所有主要平台,并在网站上提供安装说明。

By default, Thonny installs with it’s own bundled version of Python, so you don’t need to install anything else new. More experienced users may need to tweak this setting so already installed libraries are found and used.

默认情况下,Thonny会使用其自己的捆绑版本的Python进行安装,因此您不需要安装其他任何新东西。 有经验的用户可能需要调整此设置,以便找到并使用已安装的库。

Thonny IDE for beginners

WHY You’re a beginning Python user, and want an IDE that’s ready to roll.

为什么您是Python的新手,并且希望可以使用IDE。

WHY NOT More experienced Python developers will find Thonny too basic for most uses, and the built-in interpreter is something to work around, not with. Plus, as a new tool, there may be issues you find which may not have immediate solutions.

为什么不是呢?经验丰富的Python开发人员会发现Thonny对于大多数用途来说太基础了,内置解释器是可以解决的,而不是可以解决的。 另外,作为一种新工具,您可能会发现一些问题,这些问题可能没有即时解决方案。

那么哪一个适合您呢? (So Which One Is Right for You?)

Only you can decide that, but here are some basic recommendations:

只有您可以决定,但是这里有一些基本建议:

  • New Python developers should try solutions with as few customizations as possible. The less that gets in the way, the better.
  • If you use text editors for other tasks (like web pages or documentation), look for code editor solutions.
  • If you’re already developing other software, you may find it easier to add Python capabilities to your existing toolset.
  • 新的Python开发人员应尝试使用尽可能少的自定义的解决方案。 越少越好。
  • 如果将文本编辑器用于其他任务(如网页或文档),请寻找代码编辑器解决方案。
  • 如果您已经在开发其他软件,则可能会发现将Python功能添加到现有工具集中更为容易。

翻译自: https://www.pybloggers.com/2018/03/python-ides-and-code-editors-guide/

安装python 和ide

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值