开始使用python编程所需的一切

Are you ready to take the leap into programming in Python? For a beginner, it can be scary to jump into the water but trust me, all you need is a pair of swimming pants and you are good to go. And by swimming pants, I mean some basic hardware and software.

重新您准备采取的飞跃到Python编程? 对于初学者来说,跳入水中可能会很吓人,但请相信我,您只需要一条游泳裤就可以了。 我所说的泳裤是一些基本的硬件和软件。

A frequently asked question is ”which laptop should I buy for Python programming?” The good news is that Python does not require much. In this article, I will go through the basics to get you set up.

一个常见的问题是“我应该购买哪台笔记本电脑进行Python编程?” 好消息是Python并不需要太多。 在本文中,我将介绍基础知识以帮助您进行设置。

Put your pants on and let’s get started on your Python journey.

穿上裤子,让我们开始Python之旅。

  • Hardware — What you need and the difference between Desktops and Laptops

    硬件 —您需要什么以及台式机和笔记本电脑之间的区别

  • Software — Choose the Operating system that is right for you

    软件 -选择适合您的操作系统

  • Programming on your phone? — Yes, it’s 2020 after all

    在手机上编程? —是的,毕竟是2020年

  • Text Editors and IDEs

    文本编辑器IDE

  • Online — Using online coding environments

    在线 —使用在线编码环境

Disclaimer: There are no affiliate links in this article.

免责声明:本文中没有附属链接。

硬件 (Hardware)

I’m tempted to say that any machine will do. If you buy one which is less than 5-10 years old with a modern OS, chances are it will run. I’m not saying it will be a smooth experience, but it will work. What hardware you need will vary based on what you intend to code.

我很想说任何机器都可以。 如果您购买的旧操作系统不到5-10年的旧操作系统,则很有可能会成功运行。 我并不是说这将是一次平稳的体验,但是会奏效。 根据需要编写的代码,所需的硬件会有所不同。

When it comes to hardware, you are looking at either a desktop computer or a laptop. (Unless you want to develop on your phone. More on that later) What you choose is based on several needs. It often comes down to power vs. portability.

说到硬件,您正在看台式计算机或笔记本电脑。 (除非您想在手机上进行开发。以后再说)选择的是基于几种需求。 它通常归结为功耗与便携性。

桌面 (Desktop)

Python code is just text so the code itself is very light. There are other factors you need to look at when deciding what hardware you want to purchase. Since CPU, RAM, and GPU aren’t that important, I’ll start with the other parts you will interact with.

Python代码只是文本,因此代码本身非常简洁。 在确定要购买的硬件时,还需要考虑其他因素。 由于CPU,RAM和GPU并不那么重要,因此我将从与之交互的其他部分开始。

Photo of a desktop setup with a vertical monitor setup
Photo by Josh Sorenson from Pexels
PexelsJosh Sorenson

屏幕: (Screen:)

One of your main tools is your screen. The higher resolution the screen is, the more code you can display. With high-resolution screens, the text can appear small and stress your eyes so play with the settings to get an optimal setup you can use for hours.

屏幕是您的主要工具之一。 屏幕分辨率越高,可以显示的代码越多。 使用高分辨率的屏幕时,文本可能会显得很小并且使您的眼睛感到不适,因此请使用设置以获得可以使用数小时的最佳设置。

For your desktop, you want to look for a screen you can rotate 90 degrees so you can display more lines of code. 4k resolution screens are getting cheaper these days, so if you can afford it, I would recommend you look at 27 inches and up with 4k support. If you are looking for a budget screen, skip the 4k option, and go for the one that will fit your desk. You can code on a smaller screen, but I would get the biggest screen I could fit on my desk within my budget.

对于台式机,您需要寻找一个可以旋转90度的屏幕,以便显示更多代码行。 如今,4k分辨率的屏幕正变得越来越便宜,因此,如果您负担得起,我建议您选择27英寸及以上的支持4k的屏幕。 如果您正在寻找预算屏幕,请跳过4k选项,然后选择适合您办公桌的屏幕。 您可以在较小的屏幕上进行编码,但是在预算范围内,我会得到最大的屏幕,可以放在办公桌上。

If you find yourself toggling between software a lot, you should consider the ultra-wide options. With these monitors, you can have your applications lined up side by side. After working on a 38" ultra-wide for a couple of years, I find it hard to go back to a dual-monitor setup.

如果您发现自己经常在软件之间切换,则应考虑使用超宽选项。 使用这些监视器,您可以将您的应用程序并排排列。 在38英寸超宽显示器上工作了几年后,我发现很难回到双显示器设置。

键盘 (Keyboard)

You’ll almost spend as much time typing on your keyboard as you’ll be looking at your screen. After all, you are writing code. A keyboard that works for you, might be the worst for another person. Choosing the right keyboard is individual, just remember that you will be using it for hours and hours so it is important that it is comfortable to use.

您几乎要花费与在屏幕上看一样多的时间在键盘上打字。 毕竟,您正在编写代码。 一个对您有用的键盘,对于其他人而言可能是最糟糕的。 选择合适的键盘是个人的,请记住您将要使用数小时,因此使用起来要舒适很重要。

I have used a variety of keyboards in the past and recently threw my custom WASD keyboard away replacing it with an Apple Magic Keyboard.

过去,我曾经使用过各种键盘,最近我放弃了自定义的WASD键盘,将其替换为Apple Magic Keyboard

Photo of the WASD keyboard next to the Apple Magic Keyboard
Top: WASD keyboard, bottom: Apple Magic Keyboard. Two very different experiences. Image by Author
顶部:WASD键盘,底部:Apple Magic Keyboard。 两种截然不同的经历。 图片作者

The WASD keyboard has mechanical keys (which is preferred by many programmers) with a nice travel distance. It is a heavy device making it appear solid. To me, the height put me off as my wrists hurt from long typing sessions. You can avoid this by getting wrist support, but the ultra-flat Apple Magic keyboard is more comfortable to me. The travel on the Apple Magic keys is shorter, but the feel of the keyboard is very comfortable and I can type for days.

WASD键盘具有机械键(许多编程人员首选),并且具有不错的行程距离。 这是一个很重的设备,使其看起来很坚固。 对我来说,由于长时间打字导致手腕受伤,身高使我感到不适。 您可以通过腕部支撑来避免这种情况,但是超扁平的Apple Magic键盘对我来说更舒适。 Apple Magic键的行程较短,但键盘的手感非常舒适,我可以打字几天。

You should try the keyboard for several long sessions before you make up your mind. If it feels good after a couple of 10-hour days, you might have found your typing mate. If you live somewhere with good return options, give it a spin and send it back if it doesn’t fit your fingers.

在下定决心之前,您应该尝试键盘数个长时间的练习。 如果经过20个小时的工作后感觉良好,则可能是您找到了打字伙伴。 如果您住在有良好回报选择的地方,请旋转一下并在不适合您的手指时发回。

If a normal, flat keyboard hurts, you can look for options where the keyboard is split and tilted. My brother-in-law recently introduced me to the Ergodox EZ keyboard which looks like a very interesting option.

如果普通的扁平键盘不舒服,您可以在分开和倾斜键盘的情况下寻找选项。 我的姐夫最近向我介绍了Ergodox EZ键盘,这似乎是一个非常有趣的选择。

I suggest you get a keyboard with a US layout. This layout is perfect for writing code. I am Norwegian, but I have a US layout on all my keyboards for this reason. You can always toggle languages in software if you need your native letters. I’m looking at you ”æ,ø,å”.

我建议您使用美国布局的键盘。 此布局非常适合编写代码。 我是挪威人,但由于这个原因,我的所有键盘上都有美国布局。 如果您需要本机字母,则始终可以在软件中切换语言。 我在看着你“æ,ø,å”。

You might not use the Numpad much. In that case, you can look into compact keyboards. Several manufacturers create compact versions of their keyboards. Make sure they didn’t put the arrow keys in a strange position.

您可能不太常使用数字键盘。 在这种情况下,您可以查看紧凑型键盘。 一些制造商创建了他们的键盘的紧凑版本。 确保他们没有将箭头键放在一个奇怪的位置。

老鼠 (Mouse)

It’s tempting to say that it doesn’t matter what mouse you go for because you will not use your mouse much after all. Even though typing is your main activity, you will browse the web (mostly StackOverflow) and use your mouse for a lot of other operations. This is just as personal as the keyboard when it comes to preferences, but make sure you get a mouse that does not hurt your hand. Your hand is your tool, take care of it!

诱人的说法是,购买哪种鼠标都没有关系,因为您毕竟不会使用太多鼠标。 即使键入是您的主要活动,您仍将浏览网络(主要是StackOverflow)并使用鼠标进行许多其他操作。 在使用偏好时,这和键盘一样私人,但是请确保您使用的鼠标不会伤手。 您的手就是您的工具,多多关照!

As much as I love the Apple Magic Keyboard, the Magic Mouse is not that great. In my opinion, Apple was never good with mice and the Apple Magic Mouse has a very bad ergonomic shape. The only reason I use one these days is because of the integrated trackpad on top of the glass. It is fantastic for browsing, but I have a Steelseries Kana right next to it when I need to do some more heavy-duty work as the grip is more comfortable.

尽管我喜欢Apple Magic Keyboard,但Magic Mouse并不是那么出色。 在我看来,Apple从来都不擅长使用鼠标,而Apple Magic Mouse的人体工学设计却非常糟糕。 我最近使用一个的唯一原因是由于玻璃上方集成了触控板。 这是浏览的绝佳选择,但是当我需要做一些繁重的工作时(因为握把更加舒适),我旁边有一个Steelseries Kana。

Photo of the Apple Magic Mouse next to the Steelseries KANA
Apple Magic Mouse with the supporting Steelseries KANA. Image by Author
Apple Magic Mouse鼠标以及配套的Steelseries KANA。 图片作者

You should consider the form factor when purchasing a mouse. Using a normal keyboard is already twisting your wrists into an unnatural position. You might want to consider getting a mouse with a slight vertical angle to take some stress away from your wrist. The Logitech MX Master 3 is a popular option these days and has a slight tilt. I currently have this in order and hope it is as good as all the reviews say it is. You can get mice with a full vertical layout or a joystick layout if that works better.

购买鼠标时,应考虑外形尺寸。 使用普通键盘已经使您的手腕扭动到不自然的位置。 您可能需要考虑使鼠标具有较小的垂直角度,以减轻手腕的压力。 罗技MX Master 3如今已成为流行选项,并且略有倾斜。 我目前有此顺序,并希望它与所有评论中所说的一样好。 如果效果更好,则可以使鼠标具有完整的垂直布局或操纵杆布局。

CPU和RAM (CPU and RAM)

There is not much to say about the CPU as most CPUs will run Python. A stronger CPU will always be faster than a weak one so purchase the CPU you can afford. Python is already a slow language. No need to make it even slower with a poor CPU.

关于CPU的说法不多,因为大多数CPU将运行Python。 较强大的CPU总是比较弱的CPU更快,因此,请购买可以承受的CPU。 Python已经是一种慢语言。 如果CPU较差,则无需使其变慢。

Note that Python is also single-threaded.

请注意,Python也是单线程的。

From the Python Documentation:

Python文档中

In CPython, due to the Global Interpreter Lock, only one thread can execute Python code at once (even though certain performance-oriented libraries might overcome this limitation). If you want your application to make better use of the computational resources of multi-core machines, you are advised to use multiprocessing or concurrent.futures.ProcessPoolExecutor. However, threading is still an appropriate model if you want to run multiple I/O-bound tasks simultaneously.

在CPython中,由于使用了全局解释器锁 ,因此只有一个线程可以一次执行Python代码(即使某些面向性能的库可以克服此限制)。 如果希望您的应用程序更好地利用多核计算机的计算资源,建议您使用multiprocessingconcurrent.futures.ProcessPoolExecutor 。 但是,如果您要同时运行多个I / O绑定任务,则线程化仍然是合适的模型。

If you find yourself working with heavy calculations you might need more RAM, but for most tasks, you don’t need much. Some tasks need to store results in memory while you work on them, but again, for most tasks, you should be fine with a low amount of RAM.

如果您发现自己需要进行大量计算,则可能需要更多的RAM,但是对于大多数任务而言,则不需要太多。 有些任务在处理结果时需要将结果存储在内存中,但是同样,对于大多数任务,使用少量的RAM应该可以。

Remember that applications like the browser and your IDE will use a lot of RAM, so if you’re not on a tight budget, go for more RAM in general. 4GB might do, but that is on the very low end of the scale and you will see that most of it will probably be used throughout the day. Today most desktops are equipped with 8GB-64GB of RAM — which of course will have no problem with Python.

请记住,诸如浏览器和IDE之类的应用程序将使用大量RAM,因此,如果您的预算不紧张,通常会增加RAM。 4GB可能会用,但这只是规模的低端,您会发现其中大部分可能全天使用。 如今,大多数台式机都配备了8GB-64GB的RAM-当然,使用Python毫无问题。

显卡 (GPU)

As you probably guessed, Python is not GPU heavy either. You will be fine with almost any graphics card. One thing you might consider is that you can use GPU for machine learning so if you plan to go down that route, you could invest in a better graphics card just to be prepared.

您可能已经猜到了,Python也不是GPU重的。 几乎所有图形卡都可以。 您可能会考虑的一件事是,您可以使用GPU进行机器学习,因此,如果您打算走这条路,那么您可以投资购买更好的图形卡以作准备。

硬盘 (Hard Drive)

Python code is just text and if you look at your python programs, you will see that we are talking kB and not MB. This means that the code itself does not require much space on your hard drive. The data you create with your code, on the other hand, might require space so this is what you have to add to the equation. Another thing that will eat up some hard drive space is your operating system and other software installed.

Python代码只是文本,如果您查看python程序,您会发现我们在谈论kB,而不是MB。 这意味着代码本身在硬盘驱动器上不需要太多空间。 另一方面,使用代码创建的数据可能需要空间,因此这是您必须添加到方程式中的内容。 会占用一些硬盘空间的另一件事是您的操作系统和安装的其他软件。

There are two kinds of hard drives — the solid-state drive SSD and the Hard Disk Drive HDD. An SSD is way faster than an HDD so as a general rule you would like to use an SSD. They are pricy compared to an HDD so again, it comes down to budget. You can consider using an SSD for your operating system and an HDD as a second hard drive just to maximize size.

硬盘驱动器有两种:固态驱动器SSD和硬盘驱动器HDD。 SSD比HDD快得多,因此一般来说,您想使用SSD。 与HDD相比,它们价格昂贵,因此又要归结为预算。 您可以考虑将SSD用作操作系统,将HDD用作第二个硬盘驱动器,只是为了最大程度地增大大小。

We are storing more and more content in the cloud and your code would in most cases be uploaded to Github. This means that the need for a hard drive is not as important as it was 10–20 years ago. I store most of my work files using iCloud. It works both as a backup and it is easy to sync the files between devices.

我们正在云中存储越来越多的内容,并且在大多数情况下,您的代码将被上传到Github。 这意味着对硬盘驱动器的需求没有10-20年前那么重要。 我使用iCloud存储大部分工作文件。 它既可以用作备份,又可以轻松在设备之间同步文件。

网络摄像头 (Web camera)

I guess you didn’t see that one coming. When you buy a laptop, a web camera is almost always included in the screen frame. When you buy a desktop, you have to buy that separately (unless you buy an iMac or similar). If you go from beginner hobbyist to junior developer, you will most likely see yourself doing digital meetings with the team. You don’t want to be that guy without a camera. As a bonus, it forces you to keep your room tidy.

我想你没有看到那个来。 当您购买笔记本电脑时,网络摄像机几乎总是包含在屏幕框架中。 购买台式机时,您必须单独购买(除非您购买iMac或类似产品)。 如果您是从初学者到初级开发人员,那么您很可能会看到自己与团队进行数字会议。 你不想成为没有相机的那个人。 作为奖励,它迫使您保持房间整洁。

笔记本电脑 (Laptop)

OK, onto the portable little brother.

好,到便携式的小弟弟。

You can always bring extra equipment, like a keyboard and mouse, but let’s focus on what makes a laptop a laptop. The examples we are looking at here are a bit on the expensive side, but remember that you can get away with second-hand laptops and I’ll also let you in on a secret. You can get away with the cheapest laptop you can find. The key is online coding environments.

您总是可以带来额外的设备,例如键盘和鼠标,但让我们集中讨论笔记本电脑成为笔记本电脑的原因。 我们在这里看到的示例有些昂贵,但是请记住,您可以摆脱二手笔记本电脑的困扰,我也将让您保密。 您可以买到最便宜的笔记本电脑。 关键是在线编码环境。

Photo of man sitting in a café with a laptop
cottonbro from cottonbro,来自 Pexels Pexels

屏幕 (Screen)

You will be looking at your screen all day. An 11" or a 13" will give you great portability, but working on a 15"- 17" will give you more space. The Macbook Pro 16" 2019 model with its retina display (3072×1920) has a footprint of the old 15". The DELL XPS, the Lenovo X1 Carbon, and the Razer Blade all have a brilliant resolution of 3840 x 2160. With bigger screens, you can get better resolution, but you are giving away some of that portability. In my opinion, they are so light anyways that it is a clear advantage to go a bit bigger.

您将整天看着屏幕。 11英寸或13英寸将为您带来极大的便携性,但是15英寸至17英寸的工作空间将为您提供更多空间。 配备视网膜显示屏(3072×1920)的Macbook Pro 16“ 2019型号的占地面积仅为旧的15”。 DELL XPS,Lenovo X1 Carbon和Razer Blade都具有3840 x 2160的出色分辨率。使用更大的屏幕,您可以获得更好的分辨率,但是却放弃了某些便携性。 我认为它们无论如何都是轻量级的,以至于更大一点是一个明显的优势。

According to Just Josh he can view more 30% more lines of code on the Macbook Pro 16" vs. his Surface Book 2 15" and Aero 17" laptops. They all have the same vertical screen height of 8.5".

根据Just Josh的说法,与他的Surface Book 2 15”和Aero 17”笔记本电脑相比,他在Macbook Pro 16”上可以查看多30%的代码行。它们的垂直屏幕高度均为8.5”。

键盘 (Keyboard)

If you go for a MacBook Pro, you have to be aware that between 2015–2019, Apple shipped them with a butterfly keyboard. This keyboard has been notorious for malfunctioning and the key travel is almost non-existent. In 2019 they started shipping models with the new Apple Magic Keyboard and these are a delight to type on. They are not mechanical but feels just like the standalone version of the Magic Keyboard. If you do get a MacBook with a butterfly keyboard, Apple has a warranty program where you can get a replacement if you have issues with it.

如果您要购买MacBook Pro,则必须知道,在2015年至2019年之间,Apple随附了蝴蝶键盘。 该键盘因故障而臭名昭著,并且几乎不存在琴键行程。 在2019年,他们开始使用新的Apple Magic Keyboard交付型号,可以轻松键入。 它们不是机械的,但感觉就像魔术键盘的独立版本一样。 如果您确实购买了带有蝶形键盘的MacBook,那么Apple会提供保修计划,如果您遇到问题,可以更换它。

Hate it or love it, Apple’s lineup has the touch bar instead of the F-keys. I love this as it gives a lot of flexibility, but there are a lot of people out there who absolutely hate them. If you depend on Function keys, make sure you try the touch bar to make up your mind.

讨厌它还是喜欢它,Apple的产品阵容都带有触摸条而不是F键。 我喜欢它,因为它提供了很大的灵活性,但是有很多人绝对讨厌他们。 如果您依赖功能键,请确保尝试使用触摸栏来下定决心。

Some of the gaming laptops have started including mechanical keyboards so if you are looking for that tactile feel, you can get your hands on that on the go as well.

一些游戏笔记本电脑已经开始包括机械键盘,因此,如果您希望获得触感,那么您也可以随时随地使用它。

Beware! One thing you need to be aware of when you get a laptop is that manufacturers need to make some compromises to make these machines light and small. You have to check the layout of the keyboards. In the newest lineup on the MacBook Pros, the ESC key is back in its physical form. Good news for programmers. Razer Blade had an absurd placement of the arrow keys, but it looks like they have changed this in their newest lineup. Make sure you do some research so you don’t end up hating every other keystroke.

谨防! 购买笔记本电脑时,您需要了解的一件事是,制造商需要做出一些妥协才能使这些机器轻巧小巧。 您必须检查键盘的布局。 在MacBook Pro的最新产品阵容中,ESC键又恢复了其物理形式。 对程序员来说是个好消息。 Razer Blade的箭头键摆放得很荒谬,但看起来他们在最新的阵容中已经改变了这一点。 确保您进行了一些研究,以免最终讨厌其他按键。

触控板 (Trackpad)

Some manufacturers might as well not include a trackpad. In my experience, no-one can remotely match the MacBook trackpad. Maybe Razer, but I haven’t tried it myself, only heard from fellow co-workers that it is a great one. If you don’t want to bring a mouse, make sure you are happy with the trackpad.

一些制造商可能还不包括触控板。 以我的经验,没有人可以远程匹配MacBook触控板。 也许是Razer,但我还没有亲自尝试过,只是从同事那里听说它很棒。 如果您不想带鼠标,请确保对触控板感到满意。

If the trackpad is abysmal, you might get better at navigating with your keyboard though. At least it is not a complete loss.

如果触控板很糟糕,则您可能会更擅长使用键盘进行导航。 至少这不是完全的损失。

软件 (Software)

Hopefully, you managed to grab a machine by now. But what about software. You will need software to run the code, right? Depending on what you are programming, you can get away with a minimal setup for your programming machine.

希望您现在设法抢了台机器。 但是软件呢? 您将需要软件来运行代码,对吗? 根据您要编程的内容,可以为您的编程机器提供最少的设置。

The first thing we need to look at is the operating system.

我们需要看的第一件事是操作系统。

操作系统 (Operating Systems)

To start programming, you need an operating system (OS). Python is cross-platform and will work on Windows, macOS, and Linux. It is mostly a matter of personal preferences when it comes to choosing an operating system.

要开始编程,您需要一个操作系统(OS)。 Python是跨平台的,可在Windows,macOS和Linux上运行。 选择操作系统时,主要取决于个人喜好。

According to Stack Overflow’s 2020 survey, 45.8% develop using Windows while 27.5% work on macOS, and 26.6% work on Linux.

根据Stack Overflow的2020年调查 ,使用Windows进行开发的占45.8%,而在macOS上工作的占27.5%,在Linux上工作的占26.6%。

视窗 (Windows)

You are probably familiar with Windows as they are widely used throughout the world. The latest version of Windows is Windows 10. Generally, you should be on the latest version of the OS, but if you have an older machine or other software requires it, you might be stuck with Windows 7 or older. You should be fine with both, but be aware that if you want to use Python 3.5 or above, Windows XP is not supported.

您可能已经熟悉Windows,因为它们在世界范围内得到了广泛使用。 Windows的最新版本是Windows10。通常,您应该使用最新版本的OS,但是如果您使用的是较旧的计算机或其他软件,则可能会受Windows 7或更高版本的困扰。 两者都应该没问题,但是请注意,如果要使用Python 3.5或更高版本, 则不支持Windows XP

If you go for Windows, there are some shell options for you. Windows comes with the Command line, but also Powershell. Powershell feels more like a normal terminal you would know from the Linux- or Mac world.

如果您使用Windows,则可以使用一些Shell选项。 Windows带有命令行,但也带有Powershell。 Powershell感觉更像是Linux或Mac世界中的普通终端。

A newcomer that is even better is Windows Terminal. This highly customizable terminal is a blast to use.

Windows Terminal是一个更好的新手。 这个高度可定制的终端是一个爆炸性的使用。

print screen of the new Windows Terminal in use
The new Windows Terminal in action. Image by Author
运行中的新Windows终端。 图片作者

In the past, people have had issues with certain libraries not being supported on Windows. You might not know what libraries you will use in the future, but if you end up having issues installing any libraries, that could be the reason.

过去,人们曾遇到Windows不支持某些库的问题。 您可能不知道将来会使用什么库,但是如果最终在安装任何库时遇到问题,则可能是原因。

The Windows license is normally bundled with your machine purchase. If not you are looking at an expense between $139-$309.

Windows许可证通常与您购买的计算机捆绑在一起。 如果不是这样,那么您的费用在$ 139- $ 309之间。

苹果系统 (macOS)

Both Mac and Linux belong to the UNIX family. You can look at them as two different branches. The development will feel similar in both Operating systems.

Mac和Linux都属于UNIX家族。 您可以将它们视为两个不同的分支。 在两个操作系统中,开发过程都感觉类似。

The Mac has a built-in terminal that works right out of the box. You can install variations, like iTerm if you like more flexibility, but the original does its job perfectly. Python comes pre-installed with macOS, but make sure you check the version so you are up to date.

Mac具有内置的终端,可以直接使用。 如果您希望获得更大的灵活性,则可以安装iTerm等变体,但原始版本可以很好地完成其工作。 Python随macOS预先安装,但请确保检查版本,以确保您是最新的。

Most text editors and IDEs work on macOS.

大多数文本编辑器和IDE均可在macOS上运行。

macOS, like Windows, is not Open source, but it comes with the machine. macOS only works on a Mac (officially) so you are tied down to Apple hardware.

与Windows一样,macOS也不是开源的,但它是计算机随附的。 macOS仅可在Mac上(正式)运行,因此您只能使用Apple硬件。

的Linux (Linux)

Linux is not really the operating system, it’s a kernel. What you would consider an OS is the distributions/distros. One of the benefits of using Linux is that these distros are lightweight and super customizable. You can shop around and find the one that fits you perfectly. Some popular distros are Ubuntu, Mint, Fedora, and CentOS.

Linux并不是真正的操作系统,它是一个内核。 您认为操作系统是发行版/发行版。 使用Linux的好处之一是这些发行版轻巧且可高度自定义。 您可以货比三家,找到最适合您的一款。 一些受欢迎的发行版是Ubuntu,Mint,Fedora和CentOS。

Linux is great for development. It comes with a terminal as well and a lot of the text editors and IDEs work on Linux. Linux is open-source so it is a budget-friendly alternative.

Linux非常适合开发。 它也带有一个终端,并且许多文本编辑器和IDE在Linux上都可以工作。 Linux是开源的,因此它是预算友好的替代方案。

Python (Python)

Of course, you need Python. Head over to python.org, download the installer, and run it. If you write “python3” in a terminal (if you downloaded a python3 version) you should see it execute and print what python version you are running.

当然,您需要Python。 转到python.org,下载安装程序并运行它。 如果在终端上写“ python3”(如果您下载了python3版本),则应该看到它执行并打印您正在运行的python版本。

文字编辑器和IDE (Text Editors and IDEs)

There are many text editors out there, but please don’t be that guy who says you can write code in Notepad. At least know how to save yourself by saying “Oh, I meant Notepad++” in case you get an evil stare…

那里有很多文本编辑器,但是请不要成为那个说可以在记事本中编写代码的人。 至少知道如何通过说“哦,我的意思是Notepad ++”来拯救自己,以防万一您被邪恶的目光所笼罩……

Some things you are looking for in a text editor is:

您正在文本编辑器中寻找的一些东西是:

  • Syntax highlighting. Python is a popular language so most text editors have this as standard or as a downloadable extension.

    语法突出显示。 Python是一种流行的语言,因此大多数文本编辑器都将此作为标准或可下载的扩展名。
  • Code prediction. If you have made a variable called ninja_turtles, it is nice that the editor will predict your variable name after you start typing ninj… Having the software look for modules while you type can be used for quick coding and learning.

    代码预测。 如果您创建了一个名为ninja_turtles的变量,那么在您开始键入ninj之后,编辑器将可以预测您的变量名称,这很不错。在键入时让软件查找模块可以用于快速编码和学习。

  • Tab indent. Most editors allow you to choose how many spaces you want in a tab. Python’s PEP8 (the holy bible) states you should be using 4 spaces. Python 3 even disallows mixing tabs and spaces.

    制表符缩进。 大多数编辑器允许您选择选项卡中需要多少空格。 Python的PEP8(圣经)规定您应该使用4个空格 。 Python 3甚至不允许混合制表符和空格。

We’ll only look at a chosen few. Make sure you browse the web to look for your favorite.

我们只看选定的几个。 确保浏览网络以查找自己喜欢的。

原子 (Atom)

Atom is a lightweight text editor you can run on all operating systems. It is highly customizable, with themes and CSS/Less customization. A package manager, file system browser, git integration, and last but not least, “Teletype” which lets you cooperate on the same code in real-time, makes this a great choice for a text editor.

Atom是一个轻量级的文本编辑器,可以在所有操作系统上运行。 它是高度可定制的,具有主题和CSS / Less定制。 包管理器,文件系统浏览器,git集成以及最后但并非最不重要的“ Teletype”(可让您实时在同一代码上进行协作)使它成为文本编辑器的绝佳选择。

screenshot of the GUI of Atom
feeling bold running a light theme. The browser on the left, code in the middle, settings on the right. Code executed at the bottom using an installed community made script. Image by Author
感觉大胆运行一个轻的主题。 左侧的浏览器,中间的代码,右侧的设置。 使用已安装的社区制作脚本在底部执行代码。 图片作者

托尼 (Thonny)

Thonny is a minimalistic IDE that is perfect for beginners. With a powerful debugger, you make sure you understand your code. I never used Thonny in the past, but quickly grew fan of the tool.

Thonny是一个极简的IDE,非常适合初学者。 使用强大的调试器,您可以确保自己理解代码。 我过去从未使用过Thonny,但很快就对它感兴趣。

screenshot of Thonny in debug mode.
Thonny and its brilliant debugger. Image by Author
Thonny及其出色的调试器。 图片作者

升华 (Sublime)

Sublime has been in the game for a while and used by many. It has some nifty features, like “Multiple Selections” that allows you to rename many variables at once, and customization.

Sublime已经在游戏中使用了一段时间,并被许多人使用。 它具有一些漂亮的功能,例如“多重选择”,它使您可以立即重命名许多变量以及自定义。

朱皮特 (Jupyter)

Jupyter is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.

Jupyter是一个开源Web应用程序,它使您可以创建和共享包含实时代码,方程式,可视化效果和叙述文本的文档。 用途包括:数据清理和转换,数值模拟,统计模型,数据可视化,机器学习等。

You have probably seen the nice graphical presentation of data using Jupyter before. You can install the Jupyter notebook or use the browser version. If you want to work with data, Jupyter is your goto tool.

您以前可能已经使用Jupyter看到了很好的数据图形表示。 您可以安装Jupyter笔记本或使用浏览器版本。 如果您想使用数据,Jupyter是您的必备工具。

Image for post
Jupyter in progress. Image by Author
Jupyter正在进行中。 图片作者

Visual Studio IDE (Visual Studio IDE)

Developed by Microsoft and loved by many. This extensive tool allows you to write code, debug, install libraries, use Git for source control and unit test your code.

由Microsoft开发并受到许多人的喜爱。 这个功能强大的工具使您可以编写代码,调试,安装库,使用Git进行源代码控制和对代码进行单元测试。

To find the right version for you, head over to their compare page and make sure you have a look at their python specific page.

要找到适合您的版本,请转到他们的比较页面 ,并确保您查看了他们的python特定页面

在手机上编程 (Programming on a cellphone)

Here’s a little surprise for you. You might not realize that your trusted old phone can be used to achieve great things. I must admit, I have never done any proper coding on my phone (only when I desperately needed to while on vacation), but from what I have seen online, several apps will get the job done.

这给您带来一些惊喜。 您可能没有意识到,您可以信赖的旧手机可以用来成就伟大的事情。 我必须承认,我从未在手机上进行任何正确的编码(仅当我极需要在度假时),但是从网上看到的情况来看,有几个应用程序可以完成这项工作。

的iOS (iOS)

Pythonista is a popular one and fronted as a full IDE for development on the phone.

Pythonista是一个受欢迎的应用程序,并且作为可在手机上进行开发的完整IDE而领先

Koder is another alternative. This is a code editor and not a full IDE, but it has syntax highlighting and support for cloud services like Dropbox.

Koder是另一种选择。 这是一个代码编辑器,而不是完整的IDE,但具有语法突出显示功能并支持Dropbox等云服务。

Buffer Editor looks slick and minimalistic. It has Git- and Dropbox support.

缓冲区编辑器看起来很简洁。 它具有Git和Dropbox支持。

安卓系统 (Android)

Pydroid is all over Facebook Python groups and with pip support, GUI support, like PyQT, offline interpreter, syntax highlighting, and code prediction, I’m not surprised it is a popular choice.

Pydroid遍布Facebook Python组,并具有pip支持,GUI支持(例如PyQT,脱机解释器,语法突出显示和代码预测),我并不感到惊讶它是一个受欢迎的选择。

在线编程 (Programming online)

If you prefer maximum portability, you can consider using online editors. You might experience some difficulties installing libraries or similar, but you can get a lot done online as well. I used online editors for 6 months at the University for our python class last year. The benefit of logging in on any computer with a browser is great.

如果您希望获得最大的可移植性,则可以考虑使用在线编辑器。 您可能会在安装库或类似程序时遇到一些困难,但是您也可以在线完成很多工作。 去年,我在大学使用在线编辑器学习了6个月的python课程。 使用浏览器在任何计算机上登录的好处都是很大的。

Here is an overview of a few you can try out. Remember that there are always more options than what I have found, so make sure you do some research. Maybe you will find another service you like.

这里是一些您可以尝试的概述。 请记住,总是有比我发现的更多的选择,因此请确保您进行了一些研究。 也许您会找到自己喜欢的另一项服务。

复制 (Repl.it)

Repl.it hosts a variety of languages, among them python. You can collaborate with fellow programmers, connect to your Git repositories, and it has plug-in support. The free version will take you far and there are pricing options for teams.

Repl.it托管多种语言,其中包括python。 您可以与其他程序员合作,连接到您的Git存储库,并且它具有插件支持。 免费版本将带您走远,并且有针对团队的定价选项。

screenshot of repl.it working on a python script
repl.it running “Game of Life”. Image by Author
重复运行“生命游戏”。 图片作者

随处可见的Python (Pythonanywhere)

As the name suggests, pythonanywhere allows you to code no matter where you are located. This service is python only and you can have two consoles running at the same time in the free version.

顾名思义, 无论身在何处, pythonanywhere都允许您进行编码。 此服务仅适用于python,在免费版本中,您可以同时运行两个控制台。

screenshot of pythonanywhere.org working on a python script
pythonanywhere playing Yahtzee. Image by Author
pythonanywhere在玩Yahtzee。 图片作者

程序化 (Programiz)

Programiz has an online editor that is simple to use. As far as I know, it is only an editor for you to test your code and not an environment where you store your files. Correct me if I’m wrong.

Programiz具有易于使用的在线编辑器。 据我所知,它只是用于测试代码的编辑器,而不是用于存储文件的环境。 如我错了请纠正我。

screenshot of programiz working on python code
Programiz running the very famous “Hello World”. Image by Author
Programiz运行着非常著名的“ Hello World”。 图片作者

结论 (In Conclusion)

I hope getting started with Python doesn’t look scary anymore if it did earlier. As you can see, you don’t need much to start learning Python. If you have a browser, you can start learning. When you get more into Python and realize this is something you enjoy doing, you can consider upgrading. When you do that, you still don’t need much to proceed. That is the beauty of this lightweight programming language.

我希望Python的入门如果再早一点也不会令人恐惧。 如您所见,开始学习Python并不需要太多。 如果您使用的是浏览器,则可以开始学习。 当您深入了解Python并意识到这是您喜欢做的事情时,可以考虑升级。 当您这样做时,您仍然不需要太多的步骤。 这就是这种轻量级编程语言的优点。

Of course, purchase what you can afford. You must always consider if you need what you are purchasing, but hardware can never be too good.

当然,购买您负担得起的东西。 您必须始终考虑是否需要购买的东西,但是硬件永远不会太好

I hope you will enjoy this fantastic journey and that some choices are clear now that we have discussed a variety of alternatives.

希望您会喜欢这个奇妙的旅程,并且由于我们已经讨论了多种选择,因此现在可以明确选择一些。

M

中号

翻译自: https://towardsdatascience.com/everything-you-need-to-get-started-with-python-programming-4a37a46e427b

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值