learnpythonthehardway下载_LearnPythonTheHardWay学习笔记1:学习环境搭建

觉得学习这本书应该有笔记,所以就从这里开始吧。

学习资料:

1.《笨办法学Python》(承德-至阳整理 2013/7/19)

2.《Learn Python The Hard Way,3rd Edition》 (Zed A. Shaw 2010)

一、准备学习环境

(二)下载集成开发环境,我使用的是EditPlus4.1,因其为收费版,怎么找能用的,你懂的。

配置集成开发环境:

1.打开EditPlus,点击 工具->配置用户工具

点击 组名,新建一个python组,点击 添加工具->应用程序,按上图所示在菜单文字、命令、参数、初始目录、动作中添加或选择相应的内容。

2.为了可以捕捉错误输出和输出结果,在上图 动作 下拉菜单中选择捕捉输出,点击 输出模板,按下图所示填写相关内容。

3.安装EditPlus的python插件,下载地址http://www.editplus.com/files/pythonfiles.zip,解压后复制到EditPlus的安装目录即可,如果软件自带可不覆盖,使用最新的即可。插件的主要功能是让EditPlus支持语法高亮和函数自动补全功能。

让它们发挥作用: 选择 工具->配置用户工具,点选左侧选项卡中的文件->设置&语法,右侧 文件类型 选择 python,如下图所示:

语法文件:python_extd.stx(也就是editplus目录下面的解压的文件)

自动完成:python.acp

4.点击 上图的 函数模板修改一下这里的正则表达式为:[ \t]*def[ \t].+: 确定之后再点击 Tab/缩进,然后填写相应的东西。这里主要是为了让python代码可以自动随进,我们设置了默认是四个空格,这样写出来的代码就很漂亮了!

5.最后一步可以设置一下python的默认模板,它的作用是让你新建文件更快捷。

在EditPlus的安装目录新建一个template.py文件,内容如下:

#!/usr/bin/python

# -*- coding: utf-8 -*-

点击 工具->配置用户工具,在左侧的选项卡中点击 文件->模板,点击右侧的 添加按钮,在弹出的对话框中选择上边新建的template.py文件,菜单文本 中填写 python,点击 确定 即可。

6.最后建立一个养眼的颜色方案。

新建 EditPlus颜色配置.ini 文件,内容如下:

[Colors\Text]

Foreground=14738148

Background=3420457

Default=0

[Colors\Embedded script]

Foreground=15000288

Default=0

[Colors\Active line]

Foreground=15000288

Background=2699572

Default=0

[Colors\Text selection]

Background=16512

Default=0

[Colors\Line number]

Foreground=11723505

Background=3420457

Default=0

[Colors\Ruler]

Foreground=11723505

Background=3420457

Default=0

[Colors\Cursor indicator]

Foreground=15000288

Background=2699572

Default=0

[Colors\Output window]

Foreground=16777215

Background=2699572

Default=0

[Colors\Tabs and spaces]

Foreground=30444

Default=0

[Colors\Line break]

Foreground=1638527

Default=0

[Colors\Column marker]

Foreground=15593186

Default=0

[Colors\Matching Brace]

Foreground=11221743

Background=2699572

Default=0

[Colors\Folding mark -]

Foreground=15000288

Background=2699572

Default=0

[Colors\Folding mark +]

Foreground=15000288

Background=2699572

Default=0

[Colors\URL]

Foreground=11635815

Default=0

[Colors\Markers]

Background=2699572

Default=0

[Colors\Matching words]

Background=3420457

Default=0

[Colors\Keyword 1]

Foreground=6539155

Default=0

[Colors\Keyword 2]

Foreground=11635815

Default=0

[Colors\Keyword 3]

Foreground=30444

Default=0

[Colors\Keyword 4]

Foreground=7163599

Default=0

[Colors\Keyword 6]

Foreground=11635815

Default=0

[Colors\Keyword 7]

Foreground=6709465

Default=0

[Colors\Line comment]

Foreground=9669757

Default=0

[Colors\Line comment 2]

Foreground=10063553

Default=0

[Colors\Block comment]

Foreground=10063553

Default=0

[Colors\Block comment 2]

Foreground=10063553

Default=0

[Colors\Quotation]

Foreground=30444

Default=0

[Colors\Quotation 2]

Foreground=30444

Default=0

[Colors\Keyword 8]

Foreground=30444

Default=0

[Colors\Keyword 9]

Foreground=30444

Default=0

[Colors\Keyword 10]

Foreground=30444

Default=0

到EditPlus安装目录观察其颜色配置文件的文件名,我的是editplus_u,将其改名,将上边的ini文件改成该名字复制到这里就可以了。

下面带你去看一下代码效果,选择菜单栏的新建就可以看到有一个python选项了.在这里你简单写点代码测试一下你的配置环境有没有成功。看到报错信息,在下面的错误上面双击就可以跳到错误行了很方便,不然上千行你去找累啊!写完之后保存按ctrl+1就可以运行代码了!

要注意的是需要输入参数和在运行中需要人机交互的程序,还是需要在控制台环境下运行,我还没找到更好的方法。

(三)我有时候喜欢在多个地点学习,配置了多台计算机,怎么能同步学习进度呢,我采用了使用git的方法,下面讲一下我自己琢磨的git的使用。(参考了廖雪峰的git教程)

1.在gtihub上注册账号。

2.如果是linux系统,一般内置git,直接使用即可,如果没有,google或百度之进行安装就行了;如果是windows操作系统需要安装git支持程序,win7以上可以到Git for Windows下载git的客户端,如果是winXP可以到Babun - a windows shell you will love!下载babun,使用方法可以自己查看帮助文档。这里只讲git的配置和使用方法。

3.建立本地git账号

git config --global user.name 你的名字

git config --global user.email 你的邮箱

4.在本地生成ssh公钥和私钥

ssh-keygen -t rsa -C 你的邮箱名(也可以试试别的)

设置ssh文件夹权限

chmod 755 ~/.ssh/

chmod 600 ~/.ssh/id_rsa

chmod 600 ~/.ssh/id_rsa.pub

chmod 644 ~/.ssh/known_hosts

要注意的是.ssh文件夹会因为系统不同位置不同,具体可google或百度。known_hosts可能一开始会没有,在你使用git上传代码之后会自动生成,之后就可以设置了。

将生成的公钥id_rsa.pub中的内容上传到github,即 登录你的github账号 -> settings,在出现的页面左侧点击SSH and GPG keys,

点击 New GPG key,将公钥粘贴到出现的页面里提交即可。

5.几种git的使用方法:

(1)本地无任何内容,克隆一个完整的工程:

git clone git@github.com:你的账号/LearnPythonTheHardWay.git

(2)本地已有工程,更新到最新:

git fetch --all

git reset --hard LearnPythonTheHardWay/master

(3)本地新建的工程上传:

第一次执行以下命令:

git init

git add . #(所有内容添加到仓库)

git commit -m "说明" #告诉git修改版本提交

git remote add LPTHW git@github.com:你的账号/LearnPythonTheHardWay.git

git push -u LPTHW master

之后每次提交执行以下命令:

git add . #(所有内容添加到仓库)

git commit -m "说明" #告诉git修改版本提交

git push -u LPTHW master

至此开发环境已全部配置完毕,可以开始学习之旅了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值