Mac Swampy(Python学习模块)安装 [英] Mac Swampy (Python learning module) install

查看:141
本文介绍了Mac Swampy(Python学习模块)安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以为我会教孩子们编程,并且正在使用Downey的"Think Python".这本书非常棒,除了他要安装"Swampy"类似于海龟的学习模块之外.我花了几个小时试图弄清楚-现在我需要帮助.

I thought I would teach my kids programming and am using "Think Python" by Downey. The book is great except when he gets to installing "Swampy" a Turtle-like learning module. I've spent a few hours trying to figure it out--now I need help.

任何人都可以提供有关如何安装Swampy的清晰,分步的说明集吗?请假定您对Unix等具有零先验知识.

Can anyone offer a clear, step-by-step set of instructions on how to install Swampy? Please assume zero prior knowledge of Unix, etc.

我在OS X(10.6.6)上. Python运行正常. Tkinter很好.

I'm on OS X (10.6.6). Python is running fine. Tkinter is fine.

以下是作者网站上提供的总体安装说明:

Here are the overall installation instructions offered at the author's site:

http://www.greenteapress.com/thinkpython/swampy/install.html

我被困在添加沼泽到您的搜索路径"部分.

I am stuck at the "Add Swampy to your search path" section.

以下是作者指向搜索路径的其他说明:

Here are the additional instructions the author points to regarding the search path:

http://docs.python.org/install/index .html#inst-search-path

购买入门文章可能很明显!

Probably terribly obvious buy tough stuff for an intro text!

更新

为以后遇到此问题的人提供的一些记录详细信息:

A few details for the record for anyone who comes across this later:

  1. 我的安装中没有文件或文件夹"python2",因此路径名"/home/downey/swampy-2.0/python2"可能不起作用.我刚刚放下了"python2",一切都很好.

  1. My installation does not have a file or folder "python2" so the pathname "/home/downey/swampy-2.0/python2" might not work. I just dropped the "python2" and all was well.

查找bashpc或bash_profile文件有点问题.即使在寻找隐藏文件时似乎也不存在.所以我刚刚创建了一个新的.一切似乎都很好.

Had a bit of a problem finding the bashpc or bash_profile file. Didn't seem to exist even when looking for hidden files. So I just created a new one. All seems well.

再次感谢您的帮助-我永远都不会想出来的:)

Thanks again for your help--I would never have figured it out :)

我很惊讶,对于本书的读者(像我这样的新手),没有某种安装程序或脚本可以解决这个问题. :)

I'm surprised there isn't some sort of installer or script to handle this given the audience for the book (newbies like me). :)

推荐答案

向变量添加变量的一种简单方法是将其添加到位于 home 目录中的.bash_profile.每次打开终端时都会加载此文件.它是一个隐藏文件,因此默认情况下您将无法在 Finder中查看该文件.打开新的终端窗口后,运行以下命令:

An easy way to add variables to your path is to add them to your .bash_profile, which is located in your home directory. This file loads every time you open up terminal. It is a hidden file, so you will not be able to view it (by default) in Finder. Run this command after opening a new terminal window:

open -a TextEdit .bash_profile

这将在新的TextEdit窗口中打开配置文件.添加此&保存:

This will open the profile up in a new TextEdit window. Add this & save:

PYTHONPATH=${PYTHONPATH}:/home/downey/swampy-2.0/python2
export PYTHONPATH

假设您从网站(/home/downey/swampy-2.0/python2)的Swampy下载路径相同,那么下次运行终端时,现在应该包括该路径.

Assuming your Swampy download path is the same from the Web Site (/home/downey/swampy-2.0/python2), the next time you run terminal, the path should now be included.

这篇关于Mac Swampy(Python学习模块)安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆