问题标签 [python-3.5]

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 回答
6994 浏览

windows-10 - Windows 10 上的 Python 脚本

我是一个新的python用户。我需要运行由(远程)同事编写的脚本。

我第一次安装的 Python 是 3.5.0.rc1。它是使用 python webinstaller 安装在 Windows 10 机器上的。

在安装时,我告诉安装程序添加所有 Python 组件,并将 Python 添加到 PATH。我为所有用户授权了 python。

我可以通过命令行加载和访问 Python。它将响应基本指令 ( >>> 1+1 2)。

但是,我没有从一些基本命令中得到预期的响应(例如,>>>import os随后>>>print os.getcwd()会导致语法错误,而不是打印包含 python 可执行文件的目录)。

此外,我无法让 python 执行脚本(例如。>>>python test.py)。这会导致语法错误,似乎指向脚本文件名中的不同位置。我已经尝试快速搜索 StackOverfow 上的先前问题,但似乎无法找到关于在这个基本级别上似乎是失败的讨论。

也许我没有加载所有必要的 python 模块,或者是我缺少的其他东西

0 投票
2 回答
19536 浏览

python - 如何使用等待表达式?

无法弄清楚如何从 python 3.5-rc2 使用 await

0 投票
7 回答
25704 浏览

python - 无法在 Windows XP Professional 中安装 Python 3.5

我正在尝试从 Windows XP Professional 中安装 Python 3;但是我收到以下屏幕(没有安装按钮):

蟒蛇安装

在我看来,这显然是一个未报告的错误或渲染问题。这个问题如何缓解?如果可以克服这个问题,是否表明存在其他相关问题?

0 投票
5 回答
151478 浏览

python - Python 3.5 中的类型提示是什么?

Python 3.5 中最受关注的特性之一是类型提示

本文这篇文章中提到了类型提示的一个示例,同时还提到负责任地使用类型提示。有人可以解释更多关于它们以及何时应该使用它们以及何时不使用它们的信息吗?

0 投票
3 回答
1975 浏览

python - Generator-based coroutine versus native coroutine

I just read PEP0492 talking about the new approach on coroutines but the PEP failed to make me understand the difference between generator-based coroutines and native ones. Can someone tell me the difference (maybe with examples)?

For what I understood they uses different words (yield/yield from and await/async/yield). I understand that at the end of a native coroutine a yield is expected, but this also stands true for generator-based ones.

0 投票
3 回答
2596 浏览

python - “pip3 install numpy”在 brewed Python 3.5 上失败

我使用 OS X Yosemite 和安装了 Homebrew 的 Python 3.5。

尝试安装 NumPypip3 install numpy会导致以下错误

尤其是找不到Python.h,但确实存在于/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/include/python3.5m/Python.h

我该怎么做?

0 投票
2 回答
1609 浏览

pycharm - Pycharm 4.5.4 是否支持 python3.5?

我很好奇 pycharm 4.5.4 是否支持 python 3.5?如果没有,是否记录了何时将其包括在内?哪个版本以及何时发布?

谢谢

0 投票
0 回答
3674 浏览

python - 是否可以从 Python 中的 Generic 类继承?

从 Python 3.5 开始,您可以使用PEP-0484中描述的泛型和其他有趣的东西。我试过了,这是我的代码:

这段代码完美地工作,并做了预期的事情。然后我决定扩展这个类来做一些额外的工作。我就是这样做的:

要测试Pool我创建MyPool的类,如下所示:

然后我放了类似mypool = MyPool()的东西,效果很好。一旦我实施PoolEx,我已经更新MyPool到这个:

并试图做同样的事情:mypool = MyPool(). 不幸的是我得到了:

如您所见,我也将self.__class__.__bases其放入日志中。当我尝试测试isinstance(self, PoolEx)和类似时issubclass,我得到了 False。与super()验证相同。

是我的代码有问题还是这样的类不能有后代?如果我仍然想拥有 PoolEx,我必须使用组合而不是继承。

0 投票
1 回答
15791 浏览

python - Python 3.5 我无法安装枕头

我已经安装了 Python 3.5.0rc3 amd64,我需要安装 Pillow。所以我从http://www.lfd.uci.edu/~gohlke/pythonlibs/ Pillow‑2.9.0‑cp35‑none‑win_amd64.whl 下载了它,我也通过 pip 成功安装了它。但是当我从 PIL import Image 输入解释器时,我收到以下消息:

此外,当我卸载此软件包并尝试通过 easy_install 安装时,我遇到了另一个错误:

我能做些什么?

0 投票
1 回答
692 浏览

python - 使用哪个 Windows SDK 为 Python 3.5 构建扩展?

适用于 Windows 的 Python 3.5 是使用 Visual Studio 2015 构建的

Microsoft Visual Studio 2015,它是用于构建官方 Python 版本的编译器

您应该使用哪个版本的 Windows SDK 来构建 Python 3.5 的扩展?大概它是 Visual Studio 2015 附带的,但那是什么?我需要准确了解https://github.com/pypa/python-packaging-user-guide/pull/172

在我的电脑上,我有几个C:\Program Files (x86)\Microsoft SDKs\Windows