python - 在 cygwin/win7 上安装 scipy

标签 python scipy cygwin cython

刚刚进入 python 并需要安装一些数字处理包,其中包括在 Windows 7 机器上运行的 cygwin 环境中的 scipy。注意:我不想重新制作整个版本或主版本,我只想安装 scipy 以供使用。 scipy 网站说我应该能够使用 pip 安装它。但是,当我尝试安装它时:

$  pip install scipy

...我收到一个错误:
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: 

...接着是表面上导致错误的命令行。如果我剪切/粘贴命令行以查看导致错误的原因,我会得到大量输出,包括以下内容:
Building wheel for Cython (setup.py): finished with status 'error'
ERROR: Failed building wheel for Cython

因此,似乎制作软件包的人都调用 gcc 来实际编译依赖项——在本例中为 cython——实际上已经安装了:
$ cython --version
Cython version 0.29.14

我看到 scipy 包需要 Cython>=0.29.13,但不幸的是 pip 似乎没有考虑到这一点。它不仅以某种方式错过了 cython 已经存在的事实,而且实际上是在尝试编译一个全新的...@_@
[有趣的是,cython 网站上说最新版本是 0.28.5...]

供引用 :
$ pip --version
pip 19.3.1 from /usr/lib/python3.6/site-packages/pip (python 3.6)

我也试过从 https://pypi.org/simple/scipy 下载文件并提取它,然后尝试在本地使用 pip :
$ pip install --no-index --find-links=. .
Looking in links: .
Processing /usr/local/src/scipy-1.4.1
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
.
.
.
  ERROR: Could not find a version that satisfies the requirement wheel (from versions: none)
  ERROR: No matching distribution found for wheel
  ----------------------------------------
ERROR: Command errored out with exit status 1:

所以我找到了一些 Windows 二进制文件。试图从 https://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy 下载它们, 我面临着 .whl文件。研究中,我看到一个 .whl文件实际上是一个独立的轮子,可以通过 pip 安装。我尝试这样做:
pip install --use-wheel --no-index --find-links=. scipy-1.4.1-cp38-cp38-win32.whl

...我明白了
no such option: --use-wheel

然后 :
$ pip install --no-index --find-links=. *.whl
ERROR: scipy-1.4.1-cp38-cp38-win32.whl is not a supported wheel on this platform.

所以显然cygwin不支持windows distrib。

有没有人有这方面的经验?
关于我还能尝试什么的任何想法?

谢谢。

最佳答案

Cygwin 有自己的打包系统~~已经有 Cygwin 的 scipy 二进制包了~~。更新:我不在我的电脑前,所以我不确定,但一些谷歌搜索表明可能根本没有 python3-scipy 包。见下文...

当您安装 Cygwin 时,您可能会通过图形安装程序,它允许您选择要在 Cygwin 中安装的软件包。您始终可以通过重新运行安装程序并选择其他软件包来安装新软件包。

但是,我发现在现有的 Cygwin 安装中使用命令行软件包安装程序更容易 apt-cyg .

您可以通过运行安装它

$ wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
$ install apt-cyg /usr/local/bin

然后运行
$ apt-cyg install python3-scipy

就是这样。

如果根据我的更新,这不起作用,您也可以从源代码构建 scipy,但这需要很长时间,并且需要安装许多构建依赖项。在我的脑海里,我认为至少你应该尝试:
$ apt-cyg install python3-cython python3-numpy python3-devel openblas-devel gcc gfortran

然后试试
$ python3 -m pip install scipy

如果这仍然不起作用,请告诉我,我会添加进一步的更新。我已经在 Cygwin 上构建了 scipy 很多次,所以我知道它可以工作,但我正在写这篇文章。

目前 PyPI 不支持为 Cygwin 上传二进制轮子。我一直想改变它,但我还没有机会。但与此同时,许多流行的科学 Python 包已经在 Cygwin 包存储库中包含了包。

关于python - 在 cygwin/win7 上安装 scipy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59458833/

相关文章:

bash - '\r' : command not found - . bashrc/.bash_profile

git - 如何停止 git add -patch 不在 mintty 中显示提示

python - 如何替换整个数据集中的值?

python - 如何调试这个缓冲文件队列?

python - 将细胞分割结果转换为强度值表

python - 尝试从图像中移动像素

python - ODR错误: fcn does not output [n]-shaped array

python - 在Python中计算每年的不同ID

python - 将 scipy.optimize 用于非代数函数

c++ - 关于 Cygwin 的一些问题[Windows 中的 Linux](套接字、线程、其他编程和 shell 问题)