问题标签 [python-3.1]

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 投票
1 回答
466 浏览

python - Python 2.6 -> Python 3.1(用于使用 ttk)

我想使用 ttk 作为 tkinter 的一部分,但我的 Mac 上有 Python 2.6。所以我去安装了Python 3.1,它自带了ttk,并没有覆盖之前的版本。因此我仍然没有能力使用 ttk。

我是要解决这个问题还是我遗漏了什么?

0 投票
1 回答
290 浏览

python - Why Pygame wont QUIT properly?

No matter what I do, the window will never quit on QUIT event. It would either ignore me pressing the X button or go into "Not responding" mode. I usually restart the shell and then force close it from the Windows.

None of these methods work and not even all of them together.

0 投票
2 回答
65 浏览

python - Python:获取函数错误,未缩进错误

我是 Python 新手,我正试图让我的字符串将 'abc' 更改为 'def' 简而言之,我不断得到,"unindented does not match any other indentation level."因此,这意味着我的函数有什么问题?

0 投票
1 回答
981 浏览

python - 无法在 Windows 上导入名称 _tkagg

我需要在 32 位 Windows 下的 Python 3.1 中使用 matplotlib。如果 py 的版本不同,那将不是问题,因为 windows 有许多 matplotlib 二进制文件(py 3.4 + 安装的 matplolib 二进制文件效果很好)。由于我找不到 py3.1 的二进制文件,我决定在 pip 的帮助下安装 matplotlib。支持py3.1的最高版本是matplotlib-1.2.1。在谷歌搜索了一下后,我安装了 VS2008,然后安装成功完成,但是当我尝试绘制一个简单的图表时,什么也没发生:

我在这里发现问题可能出在默认后端。我决定将我的图表放在 tkinter 窗口中,但出现以下错误:

Fedora 和 Ubuntu 的错误解决方案在同一个主题中给出,但我不能用于 windows。我发现的其他主题也只有针对不同 Linux 发行版的解决方案。我尝试为 Windows 寻找 tkinter 开发包,但没有成功。老实说,我是一个菜鸟,并不真正了解开发包是什么(可能是一些库或源代码?)。

如果有人可以提供帮助,我会非常高兴。提前致谢。

0 投票
4 回答
45 浏览

python - 列表的另一个循环迭代

如何正确编写此代码?

预计会显示带有相同条目分数的选项卡的名称。

但显示错误:

0 投票
4 回答
38008 浏览

python - Python 菜单驱动编程

对于菜单驱动的编程,最好的方式是如何编写 Quit 函数,以便 Quit 仅在一个响应中终止程序。

这是我的代码,请尽可能编辑:

当程序第一次执行并按“q”时,它退出。但是在按下另一个功能后,回到 main 并按 q,它会重复 main 功能。谢谢你的帮助。

0 投票
1 回答
13151 浏览

python - AttributeError:“池”对象没有属性“__exit__”

我正在使用multiprocessing.Pool. 这些脚本如下所示:

当使用 Python 3.4 运行它时,一切都很好。但是,当使用 Python 2.63.1时,我收到此错误:

使用 Python 2.73.2,错误基本相同:

为什么会发生这种情况,我该如何规避这种情况?

0 投票
1 回答
1579 浏览

python - AttributeError functools.total_ordering

以下是我的代码片段。当我运行程序时,它给了我以下错误。

我正在使用 python 3.1

导入语句中是否缺少某些内容?

0 投票
1 回答
58 浏览

tkinter - 窗口中的自定义模块

我想知道当我在 IDLE 之外运行它时,如何在窗口中而不是 CMD 中获取我的代码。我将此代码与使用 tkinter 的菜单一起使用。提前致谢。另外,如果您知道如何缩短此代码,请告诉我。谢谢!

0 投票
0 回答
405 浏览

python - 使用 Python 3.1 创建 virtualenv 时出现“TypeError: 'str' object is not callable”

Ubuntu 14.10 上的这个命令:

给我这个:

如果有人分享如何处理它,我将不胜感激。

ps
我猜这个问题可能与virtualenv版本有关pip