【问题标题】:Unble to download pyinstaller with pip for python 3.4, 3.6无法使用 pip 为 python 3.4、3.6 下载 pyinstaller
【发布时间】:2018-08-14 16:36:58
【问题描述】:

我以前从未使用 pip 下载过,所以我可能会做一些愚蠢的事情,但我看过教程。 我在 cmd 中使用 pip 安装,使用 python34/Scripts 的路径(这是 pip 所在的位置)。 我正在获取控制台输出:

C:/Python34/Scripts>pip install pyinstaller
Downloading/unpacking pyinstaller
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement 
pyinstaller
Cleaning up...
No distributions at all found for pyinstaller
Storing debug log for failure [...]

我尝试使用 pip3:

C:\Python34\Scripts>pip3 install pyinstaller
Collecting pyinstaller
  Using cached PyInstaller-3.3.1.tar.gz
Requirement already satisfied: setuptools in 
c:\python34\lib\site-packages (from pyinstaller)
Collecting pefile>=2017.8.1 (from pyinstaller)
Using cached pefile-2017.11.5.tar.gz
Collecting macholib>=1.8 (from pyinstaller)
Using cached macholib-1.9-py2.py3-none-any.whl
Collecting future (from pyinstaller)
Using cached future-0.16.0.tar.gz
Collecting pypiwin32 (from pyinstaller)
Using cached pypiwin32-223-py3-none-any.whl
Collecting altgraph>=0.15 (from macholib>=1.8->pyinstaller)
Using cached altgraph-0.15-py2.py3-none-any.whl
Collecting pywin32>=223 (from pypiwin32->pyinstaller)
Could not find a version that satisfies the requirement 
pywin32>=223 (from pypiwin32->pyinstaller) (from versions: )
No matching distribution found for pywin32>=223 (from 
pypiwin32->pyinstaller)

找不到满足pywin32>=223要求的版本

这可能是因为不支持 python 3.4 吗?我会尝试下载 3.6

我尝试下载 3.6,由于某种原因,它最终在 C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.6 我在附近找不到点子。我可以将点子从 3.4 拖到 3.6 吗?

尝试将其拖过来,然后从目录C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.6 运行pip3 install pyinstaller。得到与 3.4 目录中的 pip3 相同的错误。

在这一点上,我不知所措。我确定我做错了什么,但我不知道是什么。任何帮助将不胜感激!

【问题讨论】:

  • 不,您不能只是将点数从 3.4 拖到 3.6。但是 3.6 应该已经安装并更新了 py 启动器。如果你只是在命令提示符下运行py,你会得到 Python 3.6 吗?如果是这样,py -m pip install pyinstaller 将为 3.6 安装它。
  • 另外,你还需要 Python 3.4 吗?如果你卸载它并且只有一个 Python,你的生活会更轻松。
  • 最后,只是为了确认一下:你 100% 正确地解释了它为什么不工作:当前版本的 pyinstaller 需要最新版本的 pywin32,而 pywin32 放弃了对 3.4 的支持,所以你可以没有足够新的版本。

标签: python pip pyinstaller


【解决方案1】:

当您有多个 Python 安装(除了一个 2.7 和一个 3.x 的简单情况),并且您不想使用虚拟环境时,最简单的解决方案是不要尝试运行像 pip 这样的脚本和2to3 直接,而是通过-m 运行它们。这样,您只需要知道如何在每次安装时运行 Python 本身,您就会自动知道如何运行其他所有内容。例如,如果您像这样运行 Python 3.6:

 python36

...然后你运行 Python 3.6 附带的 pip 的副本,如下所示:

python36 -m pip

这样你就可以保证它运行你想要的 pip 的副本,使用你想要的 Python 版本,所以所有东西都会安装到那个 Python 版本的站点包中。

在 Windows 上,处理多个 Python 安装的推荐方法是 py 启动器。当您安装 3.6 时,它应该已经安装了启动器(如果不存在),并将其配置为默认为 3.6。因此,您可以像这样运行 Python 3.6:

py

您应该验证这实际上运行的是 Python 3.6。但是,假设它确实如此,您可以像这样运行它的pip

py -m pip

但是,您确定要管理多个 Python 安装吗?您的代码不太可能适用于 3.4 而不是 3.6。 (如果你为 3.4 安装了一堆包,你需要冻结一个需求文件并为 3.6 安装它,但由于你以前从未使用过pip,这不是问题。)所以如果你只是卸载3.4,所有这些混乱都不会出现。

虽然你可能仍然想要py -m pip。这样,您不必将内容添加到 PATH 或 cd 到特定目录中; py 应该始终可用。

另外,如果您确实想要安装多个 Python,您确定不想使用虚拟环境吗?这样,无论你当前激活了哪个环境,pythonpip等都来自那个环境。

【讨论】:

  • 但是,我收到了this,如何将其添加到路径中?我很抱歉问了一些可能非常新手的问题,但话又说回来,我对此很陌生..
【解决方案2】:

我建议直接从该站点安装轮子,该站点托管 Windows 的预编译轮子,包括 pyinstaller:

https://www.lfd.uci.edu/~gohlke/pythonlibs/

【讨论】:

  • 这是几年前的好建议,但现在相同的预编译轮子可以在 PyPI 上使用,并且可以由 pip 安装。
  • @abarnert PyPI 上没有适用于 Python 3.4 的 pywin32 二进制轮子;在 Gohlke 的网站上有。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-26
  • 1970-01-01
  • 1970-01-01
  • 2021-11-27
  • 1970-01-01
  • 2020-01-24
相关资源
最近更新 更多