BOXonline1396529 2023-05-28 18:34 采纳率: 40%
浏览 45
已结题

CygwinPortable 中 NumPy 无法安装

CygwinPortable 中 NumPy 无法安装

我正在使用 CygwinPortable,我将 Cygwin 环境装进了一个 U 盘里。

其中,Python 版本为:

Python 3.9.16 (main, Mar  8 2023, 22:47:22)
[GCC 11.3.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

我尝试安装 NumPy 失败了,出现了如下报错:

ERROR: Could not build wheels for numpy, which is required to install pyproject.
toml-based projects

根据提示安装 pyproject

执行如下命令:

pip3 install pyproject

安装完之后还是报错。

参考这个问题的链接:error: pyproject.toml-based projects

执行如下安装命令:

pip3 install psutil

报错信息显示 psutil 不支持 Windows 版本。 (这里的报错信息我也没保留)

转而参考博文:cygwin64安装pip2安装numpy

根据指导转到:解决pip的ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (xxxx)

博文认为关键在于更换 pip 版本。

执行如下命令:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

输出如下:

~$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2518k  100 2518k    0     0   503k      0  0:00:05  0:00:05 --:--:--  492k

~$ python get-pip.py
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting pip
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/08/e3/57d4c24a050aa0bcc
a46b2920bff40847db79535dc78141eb83581a52eb8/pip-23.1.2-py3-none-any.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 221.3 kB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 23.1.2
    Uninstalling pip-23.1.2:
      Successfully uninstalled pip-23.1.2
Successfully installed pip-23.1.2

执行完该命令后的报错信息我没能保留,大概的意思就是 NumPy 编译错误。

经过检查,发现可能的原因是在勾选安装工具的时候没有安装 python-devel 这个工具包。

在菜单中选择 Open Cygwin Setup,选择安装 python39-devel

安装 NumPy 过程卡死。停滞在如下内容:

~$ pip3 install numpy
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting numpy
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/2c/d4/590ae7df5044465c
c9fa2db152ae12468694d62d952b1528ecff328ef7fc/numpy-1.24.3.tar.gz (10.9 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: numpy
  Building wheel for numpy (pyproject.toml) ... -

末尾的字符 - 仍在旋转,形如:

- -> \ ->| -> / -> -

但停滞数分钟。

换用如下命令:

/ $ pip install numpy --no-cache-dir

终端输出如下,依旧缓慢。

/ $ pip install numpy --no-cache-dir
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting numpy
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2c/d4/590ae7df5044465cc
9fa2db152ae12468694d62d952b1528ecff328ef7fc/numpy-1.24.3.tar.gz (10.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.9/10.9 MB 2.7 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: numpy
  Building wheel for numpy (pyproject.toml) ... \

末尾的字符 - 仍在旋转,形如:

- -> \ ->| -> / -> -

但每一次旋转都要停滞数分钟。

已经等了几个小时了,依然卡在这个地方。

  • 写回答

5条回答 默认 最新

  • callinglove 2023-05-28 23:14
    关注

    建议手动下载numpy的源码包,然后解压后安装,这样子应该能看到过程中的日志

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

问题事件

  • 系统已结题 6月6日
  • 已采纳回答 5月29日
  • 修改了问题 5月28日
  • 修改了问题 5月28日
  • 展开全部

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵