Cygwin 上的 Python3.6 无法安装模块

问题描述

我正在尝试在 cygwin 上运行一个使用“import numpy as np”和其他模块的程序。 当我尝试在 cygwin(使用 python3.6)上编译程序时,我收到一条错误消息,指出找不到模块 enter image description here

我已经更新了我的 pip3,当我尝试执行“pip3 install numpy”时出现错误 enter image description here

解决方法

Numpy 已经作为 Cygwin 包提供了,不需要用 pip 安装 但你需要安装安装程序。之后

$ cygcheck -c python36
Cygwin Package Information
Package              Version        Status
python36             3.6.13-1       OK

$ cygcheck -c python36-numpy
Cygwin Package Information
Package              Version        Status
python36-numpy       1.19.4-1       OK

因为我有两个包:

$ python3.6
Python 3.6.13 (default,Feb 16 2021,07:46:47)
[GCC 10.2.0] on cygwin
Type "help","copyright","credits" or "license" for more information.
>>> import numpy as np
>>>

另请注意,cygwin 上的首选软件包是 python 3.8 所以同样适用于 python38 和 python38-numpy