微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法安装 scipy.ndimage

如何解决无法安装 scipy.ndimage

因为 VSC 说 unresolved import 'scipy.ndimage' 代表 from scipy.ndimage import interpolation as inter 所以我在 binary package for Windows底部找到了 https://scipy.org/install.html。我能够

  1. 成功安装所需的 Windows VC++ buildtool,重启
  2. 从上面下载 ndimage-1.3.1.tar.gz
  3. python setup.py install 给了我以下错误
building 'ndimage._lib._ccallback_c' extension
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Indimage/src -Indimage/_lib "-IC:\Program Files (x86)\python37-32\include" "-IC:\Program Files (x86)\python37-32\include" "-IC:\Program Files (x86)\python37-32\lib\site-packages\numpy\core\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include" "-IC:\Program Files (x86)\Windows Kits\NETFxsdk\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcndimage/_lib/_ccallback_c.c /Fobuild\temp.win32-3.7\Release\ndimage/_lib/_ccallback_c.obj
_ccallback_c.c
c1: **Fatal error C1083: Cannot open source file: 'ndimage/_lib/_ccallback_c.c': No such file or directory**
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29910\\bin\\HostX86\\x86\\cl.exe' Failed with exit status 2

运行 Python v 3.7.4

这是可下载的,英特尔没有 64 位。 python -m pip install --user ndimage-1.3.1-cp39-cp39-win32.whl 给了我 ERROR: ndimage-1.3.1-cp39-cp39-win32.whl is not a supported wheel on this platform.

enter image description here

解决方法

当您提到您的 python version 3.7 时,您可以检查它是 64 bit 还是 32 bit

(py37_64) E:\>python
Python 3.7.9 (default,Aug 31 2020,17:10:11) [MSC v.1916 64 bit (AMD64)] :: Anaconda,Inc. on win32
Type "help","copyright","credits" or "license" for more information.

因此,在我的环境中,python 3.7

提到了 64 位

现在对于您的平台 python 3.7 所以它应该是 ndimage‑1.3.1‑cp37‑cp37m‑win_amd64.whlndimage‑1.3.1‑cp37‑cp37m‑win32.whl

为什么要安装包含 python 3.9 的轮文件,这就是为什么它不支持平台

,

该站点适用于 Windows 二进制文件,如预构建的轮文件 (.whl)。为您的 Python 版本和 32/64 位找到匹配的 .whl 文件(例如 scipy‑1.6.3‑cp39‑cp39‑win_amd64.whl 用于 scipy 1.6.3 用于 64 位 Python 3.9)。然后通过 pip install some_wheel_file.whl 安装它。这避免了需要使用 .tar.gz 源代码分发进行编译。

编辑:amd64 适用于所有 64 位 CPU,而不仅仅是 AMD CPU。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。