趣学python编程下载_《趣学Python编程》——1.2 安装Python

本节书摘来自异步社区《趣学Python编程》一书中的第1章,第1.2节,作者[美]Jason Briggs,尹哲 译,更多章节内容可以访问云栖社区“异步社区”公众号查看。

1.2 安装Python

安装Python相当简单。下面我们列举在Windows 7、苹果OS X,还有Ubuntu上的安装步骤。在安装Python的同时你也会安装IDLE程序的快捷方式,它是用来写Python程序的集成开发环境。如果你的电脑已经装好了Python,请直接跳到本书1.3节那一节。

1.2.1 在Windows 7上安装Python

在微软Windows 7上安装Python,先用网页浏览器打开http://www.python.org/ ,然后下载最新版的Python 3安装程序(Installer),如图1-1所示。

55458997aa456ada8aeda01fc91463ab5e8be271.png

具体下载哪一个版本的Python并不重要,只要是以数字3开头就可以。

下载了Windows安装程序以后,双击图标,然后按照提示把Python安装到默认位置,步骤如下。

1.选择“Install for All Users”,然后点击“Next”。

2.不要改变缺省路径,但要留意一下安装的路径(可能是C:Python31或者C:Python32)。点击“Next”。

3.忽略来自安装过程中定义Python的部分,点击“Next”。

安装完成后,在你的“开始”菜单中应该多了一项Python 3,如图1-2所示。

fbeee2745cc4995336c17d878ce8399bc0609598.png

接下来,按如下步骤来把Python 3的快捷方式加到桌面上来。

1.右键点击桌面,从弹出菜单中选择“新建->快捷方式”。

2.在注有“输入项目的位置”的框中输入下面内容(要确保你输入的路径就是之前所记录的那个):

bb9326fdb3e123130879c22cb754628c3ab163b6.png

你会看到如图1-3所示的一个对话框。

476cca96d9409f324d931b77256f1c60c1c9d50d.png

3.选择点击“下一步”来进入下一个对话框。

4.输入IDLE作为名字,然后点击“完成”来创建快捷方式。

现在你可以跳过后面的内容,直接到“当你安装好Python以后”那一页开始使用Python了。

1.2.2 在苹果OS X上安装Python

如果你使用的是苹果电脑,你应该已经有预先安装好的Python,但它可能是语言的早期版本。要确保你运行的是最新版本,用浏览器打开http://www.python.org/getit/ 来下载最新版本的苹果安装程序。

有两种不同的安装程序。选择下载哪一个取决于你安装的苹果OS X的版本是什么。(在顶部的菜单条上点击苹果图标,然后选择“关于这台Mac”)。按照以下操作来选择一个安装程序。

如果你运行的苹果OS X的版本介于10.3和10.6之间,请下载“32-bit version of Python 3 for i386/PPC”。

如果你运行的苹果OS X版本是10.6或更高的话,请下载“64-bit/32-bit version of Python 3 for x86-64”。

当文件下载好以后(它的文件扩展名是.dmg),双击它。你会看到在一个窗口中显示文件的内容,如图1-4所示。

912630eaf7bc9a8f6a0be77ccc6381392a55e123.png

在这个窗口中,双击Python.mpkg,然后按照提示(英文)安装软件。在安装Python前你会被提示输入管理员的密码。(你没有管理员的密码?可能要找你的父母帮忙。)

接下来,你需要在桌面上加上一个脚本来启动Python的IDLE程序。步骤如下。

1.点击屏幕右上角的Spotlight放大镜图标。

2.在出现的输入框中输入Automator。

3.点击菜单中出现的那个看起来像个机器人一样的应用。

4.在Automator启动后,选择“应用程序”模板,如图1-5所示。

5.点击“选择”来继续。

9e38f87c1356e0b1dc760893a286d3714424212d.png

6.在动作列表中找到“运行脚本”,然后把它拖到右边空白处,如图1-6所示。

3d1a6875e1bdeb666244677eded935cb90d77e89.png

7.在文本框中你会看到一个词“cat”。选择这个词并把它替换成下面的文字:

ba9f3f1f0788b9a5d11dd72c7dc0215d5320078e.png

你可能要根据你安装的Python版本的不同而改变其中的路径。

8.选择“文件->保存”,然后输入IDLE作为名字。

9.在“哪里”对话框中选择“桌面”,然后点击“保存”。

现在你可以跳过后面的内容,直接到“当你安装好Python以后”那一页开始使用Python了。

1.2.3 在Ubuntu上安装Python

在Ubuntu Linux的发布版本中有预先安装好的Python,但是它可能是较早的版本。按以下步骤在Ubuntu 12.x上安装Python 3。

1.在边条上选择“Ubuntu软件中心”(它是个看上去像个桔色袋子的图标,如果你没看到它,可以点击“Dash主页”图标,然后在对话框中输入Software)。

2.在软件中心右上角的搜索框中输入Python。

3.在出现的软件列表中选择最新版本的IDLE,如图1-7所示。

ba8f9d5a3eb0e28e59e19bf103c93f064794faf7.png

4.选择安装。

5.安装软件要输入你的管理员密码,然后点击“授权”。(如果你没有管理员密码的话,可能要找你的父母帮忙。)

在有些版本的Ubuntu上,你可能只能在主菜单上看到Python(3.2),而看不到IDLE,安装它也可以。

现在你已经安装好了最新版本的Python,让我们来试试它吧。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Chapter 2 Magic coins example. magic_coins1.py Chapter 3 Favourite sports. favourite_sports.py Furniture placeholder. furniture_placeholder.py A list of lists. list_of_lists.py A letter from Malcolm Dithering dithering_letter.py Escaping quotes quote_escaping.py The Wizard List wizard_list.py Chapter 4 The turtle draws a square. turtle1.py The turtle draws two parallel lines. turtle2.py Chapter 5 If statements if_statements.py Conditions in if-statements. conditions.py Else-if (elif) statements. elif_statements.py Strings and numbers. strings_and_numbers.py Chapter 6 Five Hellos. five_hellos.py Huge hairy pants (example 1). huge_hairy_pants1.py Huge hairy pants (example 2). huge_hairy_pants2.py Magic coins (example 2). magic_coins2.py A while-loop with multiple conditions. while_loop_multiple_conditions.py Looping through the wizard list. wizard_list_loop.py Chapter 7 A function to calculate your savings. savings.py Building a spaceship. spaceship_building.py Test function (example 1). test_function1.py Test function (example 2). test_function2.py Your age function. your_age.py Chapter 8 Giraffes (example 1). giraffes1.py Giraffes (example 2). giraffes2.py Three turtles. three_turtles.py Chapter 9 Using the abs (absolute) function. abs_function.py Using the exec (execute) function. exec_function.py Using the len (length) function. len_function.py Using the max and min functions. max_and_min.py Using the range function. range_function.py Using the sum function. range_function.py Opening a file. opening_a_file.py Writing to a file. writing_to_a_file.py Chapter 10 Copying objects (example 1). copying_objects1.py Copying objects (example 2). copying_objects1.py Guess a random number. guess_a_number.py Random desserts. random_desserts.py Using the time module. timing_lots_of_numbers.py Using pickle to save information. pickle_saving.py Using pickle to load information. pickle_loading.py Chapter 11 Drawing an eight point star. eight_point_star.py Drawing a many point star. many_point_star.py Drawing a spiral star. spiral_star.py Drawing a nine point star. nine_point_star.py Drawing a car. car.py Drawing a yellow circle. yellow_circle.py Drawing a filled green circle. green_circle.py Drawing a dark-green circle. dark_green_circle.py Drawing squares using a function. square_function.py Drawing filled and unfilled squares. filled_squares.py Drawing stars using a function. star_function.py Chapter 12 Clickable button (example 1). clickable_button1.py Clickable button (example 2). clickable_button2.py Drawing a diagonal line. diagonal_line.py Drawing a square. square.py Drawing a horizontal rectangle. horizonal_rectangle.py Drawing a vertical rectangle. horizonal_rectangle.py Drawing random rectangles. random_rectangles.py Drawing coloured rectangles. coloured_rectangles.py Using the color chooser. rectangle_colorchooser.py Drawing arcs. drawing_arcs.py Drawing polygons. drawing_polygons.py Drawing text. drawing_text.py Drawing images. drawing_images.py Basic animation (example 1). basic_animation1.py Basic animation (example 2). basic_animation2.py Using events (example 1). using_events1.py Using events (example 2). using_events1.py Using the move function. using_move.py Using the itemconfig function. using_itemconfig.py Chapter 13 Bounce (example 1) - this one doesn't do anything when it's run. bounce1.py Bounce (example 2) - stationary ball. bounce2.py Bounce (example 3) - ball moving upwards. bounce3.py Bounce (example 4) - ball moving up and down. bounce4.py Bounce (example 5) - ball moving around the screen. bounce5.py Chapter 14 Bounce (example 6) - adding the paddle. bounce6.py Bounce (example 7) - moving paddle. bounce6.py Bounce (example 8) - bouncing the ball when it hits the paddle. bounce6.py Bounce (example 9) - ending the game when the ball hits the floor. bounce6.py Chapter 15 Transparent Image - 27 by 30 pixels. transparent-image.gif 6 Stick Figure Images - left and right. stickfigure.zip 3 Platform images. platform.zip 2 Door images. door.zip Background image. background.gif Chapter 16 Stickman Game, version 1 - displaying the background. stickmangame1.py Stickman Game, version 2 - adding the within functions. stickmangame2.py Stickman Game, version 3 - adding the platform. stickmangame3.py Stickman Game, version 4 - adding lots of platforms. stickmangame4.py Chapter 17 Stick figure sprite class. stickfiguresprite.py Stickman Game, version 5 - adding the stick figure. stickmangame5.py Chapter 18 Stickman Game, version 6 - animating the stick figure. stickmangame6.py Stickman Game, version 6 - adding the door sprite. stickmangame7.py Afterword Pygame2 example. pygame-example.py Hello World Java example. HelloWorld.java Hello World C example. helloworld.c Hello World C++ example. helloworld.cpp Hello World C# example. helloworld.cs Hello World PHP example. helloworld.php Hello World Objective-C example. helloworld.m Hello World Perl example. helloworld.pl Hello World Ruby example. helloworld.rb Hello World Javascript example. helloworld.js Hello World Javascript Browser example. helloworld-js.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值