从头再来
太久想要学习python了,可惜一直以没有时间为借口,实在是罪过罪过,早就被安利过这本《Learn Python The Hard Way》,今天来正式学学它吧,以后天天来学它。
几点问题
- 首先,我检索了网上的电子版书籍,《Learn Python The Hard
Way》大多是讲python2的,python3的中文版尚未找到,英文原版的链接如下:
https://learnpythonthehardway.org/python3/preface.html - 还有一个配套的课程视频,在哔哩哔哩上有up主已经提供了,感谢:https://www.bilibili.com/video/av25675370?from=search&seid=11766017427799336866
- 在正式学习python之前,作者建议先学一下power shell命令行(针对Windows用户)怎么使用,关于这部分的详细使用,我们下篇文章将详细介绍,下面正式进入第0个练习,安装。
- 作者不推荐使用IDE,他在结尾有句话。All you need is a simple text editor, a shell, and Python.
Exercise 0: The Setup
我是windows用户,所以这里只介绍window平台的相关内容,请见谅。
- 前往 https://atom.io , 下载并安装Atom 文本编辑器(我也是第一次用,由于是外网需要科学上网才能保证下载速度,否则你懂的,不要以为GitHub会快很多一样慢)并不需要管理员权限。
- 如果电脑太卡的话,作者总结了一些替代的编辑器
Editor Name | Works On | Where To Get It |
---|---|---|
Visual Studio Code | Windows, macOS, Linux | https://code.visualstudio.com/ |
Notepad++ | Windows | https://notepad-plus-plus.org/ |
gEdit | Linux, macOS, Windows | https://github.com/GNOME/gedit |
Textmate | macOS | https://github.com/textmate/textmate |
SciTE | Windows, Linux | http://www.scintilla.org/SciTE.html |
jEdit | Linux, macOS, Windows | http://www.jedit.org/ |
- PowerShell从开始菜单搜索就可以找到,将其固定到快捷菜单方便使用,更喜欢把他称作终端Terminal
- 从官网https://www.python.org/downloads/release/python-360/下载安装python3.6(真慢几十兆的东西下了半小时),一定要勾选将python3.6添加到你的路径的选项。
- 打开terminal后,运行python(直接输入python并回车即可),键入quit()并回车是退出python
- 学会在终端中如何新建一个目录mkdir;如何切换到指定目录cd;使用你的编辑器在此目录下新建一个文件;仅使用键盘来切换窗口;回到终端列出所有文件看到你刚创建的文件ls。
- Finally, the purpose of this setup helps you do three things very reliably while you work on the exercises:
Write exercises using the text editor.
Run the exercises you wrote.
Fix them when they are broken.
Repeat.
Anything else will only confuse you, so stick to the plan.