问题标签 [swampy]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
843 浏览

python - 尝试为 Python 安装 Swampy。

所以我正在关注“Think Python”PDF 指南,这是我遇到的第一个真正障碍。我试图按照指南安装它,但它完全超出了我的想象。我知道这很含糊,但如果有人能像我是养老金领取者一样指导我完成它,我将不胜感激。

我目前正在使用 Python 2.7.6。我我下载了设置工具和 PIP,但我不能太确定。

很抱歉这个问题的开放性和模糊性,但我很困惑。

0 投票
1 回答
379 浏览

python - 请为 Python 2.7 安装 Swampy 帮助

我已经尝试了 3 个小时。我有窗户。我正在使用这个官方指南

因此,对于 Python 2 的 Windows 安装的第 2 步:它说:“要查看是否有 Tkinter,请启动 python;然后在 Python 提示符下,键入

当我从 python shell 执行此操作时,它会显示ImportError: No module named 'Tkinter'. 但是当我在命令提示符下输入 Python 并输入import Tkinter时,什么也没有发生。那我看哪一个?指示不明确。

好的,继续,第 2 步“安装 Swampy”也是我遇到的问题。要下载 pip,您必须转到此链接。但是当你到达那里时,它会说要下载“get-pip.py”的链接。世界上有什么?这只是一堵长长的文字墙。它甚至不问我是否要下载任何东西。这个要怎么下载???

说明还说“如果您仍然没有 pip,您可以从 Cheese shop 下载 Swampy zip 文件。解压缩,然后 cd 进入它创建的目录并运行:

什么cd into the directory it creates and run...意思???我很迷茫,如果有人提供帮助,我将永远感激不尽。谢谢。

0 投票
1 回答
196 浏览

pip - python 3.4+ 和 pip 的问题

我最近安装了 pip 3.4,但是我似乎无法正确使用 pip(包含在最新的 python 3 中),每当我尝试导入它时都会出现此错误:

0 投票
1 回答
100 浏览

python - Enthought Canopy v1.41, and thinkpython.com/code/swampy causes crash

Trying to learn python. Chapter 4 of Think Python by Allen Downey requires you to download package from thinkpython.com/swampy. Had trouble implementing the directions on the website, so I copied Swampy to it's own directory.

works in the interactive environment. But when I write a script and attempt to run it, python crashes and I need to re-start the kernel. Other posts on this topic suggest modifying the user path, setting Canopy as the default python environment. I'm sharing a computer (Mac Mavericks 10.9.5) and would like to to the exercises in the book w/o changing anything that will effect the other users of this computer. I'm afraid that if I change the default python setting I'll mess it up for other users.

Q: How do I import and run on my own mac user account w/o changing defaults of other users?

0 投票
2 回答
612 浏览

python - 尝试导入 TurtleWorld 时出错

我正在尝试浏览 Python 书籍 ThinkingPython 并进行了第一个案例研究,但我无法加载模块。我正在使用 python 3.3.2 和 swampy 2.1.5,并使用带有最新操作系统的 mac。当我尝试导入 TurtleWorld 时,出现错误:

回溯(最近一次调用):文件“”,第 1 行,在导入 TurtleWorld ImportError:没有名为“TurtleWorld”的模块

我不知道为什么这不起作用。任何帮助,将不胜感激。

0 投票
0 回答
18 浏览

python - Swampy 模块,Windows 8,Python 3.4

我是 Python 编程的新手。我正在使用 ThinkPython 书。我查看了所有以前的问题,没有一个标记为沼泽适用于我的情况。我已经安装了 Swampy 并且能够很好地导入它。但是,当我尝试导入 TurtleWorld 时,会发生此错误:

正如我在问题中所说,我在 Windows 8.1 上,使用 Python 3.4,沼泽 2.1.7

0 投票
2 回答
40 浏览

python - 我应该制作一个对象,但是当我尝试控制我的对象时它缺少属性?沼泽

我一直按照我的“think python”书(3.x 版本)中的说明进行操作,并且我已经完成了书中告诉我的所有事情,但是在其中一个练习中我仍然遇到了一个奇怪的错误?

这就是问题所在:我应该玩模块“swampy”中的“TurtleWorld”,这就是我所拥有的(这正是书中所写的)

当我尝试运行此代码时,它应该启动一个名为 TurtleWorld 的新程序,在那里您应该看到一只乌龟向东然后向北移动,留下两条线段,但是当我尝试运行该程序时,我收到此错误:

这真的让我很奇怪吗?就像我说的,我已经 100% 地遵循了这本书。

顺便说一下,这本书是这样说的:

“第一行是我们之前看到的 import 语句的变体;它不是创建模块对象,而是直接从模块中导入函数,因此您可以在不使用点符号的情况下访问它们。

接下来的几行创建了一个分配给世界的 TurtleWorld 和一个分配给 bob 的 Turtle。打印 bob 会产生类似的结果:

但是当我使用“打印(鲍勃)”时,我明白了吗?

我很乐意提供您需要的任何信息来帮助我:)

本书在线版链接:http ://faculty.stedwards.edu/mikek/python/thinkpython.pdf

第 47-48 页是解释这些东西的地方

这是 Swampy 下载的链接:http: //www.greenteapress.com/thinkpython/swampy/

我通过将“swampy”文件夹解压缩到“libs”文件夹中来安装 swampy,因此模块的目录现在如下所示:

D:\Python34\Lib\swampy-2.1.5

0 投票
1 回答
762 浏览

python-3.x - 在 Python 3.5.0 中安装 Swampy 模块(通过 Anaconda 安装)

我已经使用 Anaconda 安装了 Python 3,我需要安装 Swampy 模块。你能告诉我如何进行吗?

0 投票
1 回答
2856 浏览

python - ImportError:导入 swampy.TurtleWorld 时没有名为 Tkinter 的模块

我正在使用 Python 3.4 并遵循“Think Python:如何像计算机科学家一样思考”一书。实际上,我一周前就发现了这个问题,但是当它无法像上周那样运行时,我保存了原始代码。现在我有:

产生:

当我上周让代码工作时,我松散地记得在'import tkinter'行中,最后有一部分看起来像这样:[Tkinter]. 我试过import tkinter as Tkinter了,但它不起作用。

如果我将其更改为 Python2.7。并运行

TurtleWorld 窗口打开,但没有海龟。我怎样才能让它再次工作(首选 Python 3.4)?

0 投票
1 回答
737 浏览

python - Python Turtle AttributeError: 'Turtle' object has no attribute 'position'

I have the following code to play with turtle within turtleworld:

There is no issue with executing the fd(bob, 100) line but when I try to check turtle position it returns AttributeError:

Why is this happening? What am I missing? I have read the documentation and it states that both position() and reset() methods should be available.