简体   繁体   English

Numpy/Pandas/Matplotlib 安装时间太长

[英]Numpy/ Pandas/ Matplotlib taking too long to install

I've decided to install of MacOs Big Sur and now I do have to reinstall all the packages again... But I'm facing some problems.我已决定安装 MacOs Big Sur,现在我必须再次重新安装所有软件包...但我遇到了一些问题。

I don't have much experience using terminal, but it is taking too long to install some data science libraries.我没有太多使用终端的经验,但是安装一些数据科学库需要很长时间。 For example, to install numpy it took some minutes, and right now, it's been 15 minutes since I've started to try to install the pandas lib例如,安装 numpy 需要几分钟,而现在,我已经开始尝试安装 pandas lib 已经 15 分钟了

pip3 install pandas
Defaulting to user installation because normal site-packages is not writeable
Collecting pandas   Using cached pandas-1.1.4.tar.gz (5.2 MB)
Installing build dependencies ... -
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: numpy>=1.15.4 in ./Library/Python/3.8/lib/python/site-packages (from pandas) (1.19.4)
Collecting pytz>=2017.2
Downloading pytz-2020.4-py2.py3-none-any.whl (509 kB)
 |████████████████████████████████| 509 kB 1.2 MB/s 
Requirement already satisfied: python-dateutil>=2.7.3 in ./Library/Python/3.8/lib/python/site-packages (from pandas) (2.8.1)
Requirement already satisfied: six>=1.5 in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)
Building wheels for collected packages: pandas
Building wheel for pandas (PEP 517) ... \

I've been stuck at this screen for ages.我已经被困在这个屏幕上很多年了。 15 minutes, minimum. 15 分钟,最少。 I can hear the fans of the computer working at full speed, also the laptop is getting warm.我能听到电脑风扇全速运转的声音,笔记本电脑也开始发热。 Why is it taking so long?为什么需要这么长时间? Since it's only a small lib... I don't remember taking this amount of time when I installed it previously on another MacOs versions... Am I doing something wrong?因为它只是一个小库......我不记得我以前在另一个 MacOs 版本上安装它时花了这么多时间......我做错了什么吗? Thank you.谢谢你。

Looks like Pip can not find an appropriate Pandas wheel for your platform (macOS 11.0, Python 3.8).看起来 Pip 找不到适合您的平台(macOS 11.0、Python 3.8)的Pandas 轮 The closest available match is for macOS 10.x.最接近的可用匹配适用于 macOS 10.x。 Instead, Pip needs to build the wheel (compile and link the library) before installing.相反,Pip 需要在安装之前构建轮子(编译和链接库)。

I can't say for sure without testing, but I suspect the platform tag changed on Big Sur from macosx_10_9_x86_64 to something like macosx_11_0... .没有测试我不能肯定地说,但我怀疑 Big Sur 上的平台标签macosx_10_9_x86_64macosx_11_0...类的东西。

Until numpy/pandas maintainers release binary wheels for your platform, one option is to build them yourself.在 numpy/pandas 维护者为您的平台发布二进制轮子之前,一种选择是自己构建它们。

Seems the homebrew Python doesn't suffer from this problem, so you might want to give this a try .似乎自制的 Python 没有遇到这个问题,所以你可能想试一试

Main issue seems to be Big Sur trying to protect this python3 installation it ships with.主要问题似乎是 Big Sur 试图保护它附带的这个 python3 安装。 python@3.8 as is on the OS will throw these problems such as操作系统上的 python@3.8 会抛出这些问题,例如

Defaulting to user installation because normal site-packages is not writeable

I'd recommend installing another version of python3.8 with我建议安装另一个版本的python3.8

brew install python@3.8

and writing a symlink to use that in the future.并编写一个符号链接以供将来使用。

ln -s -f /usr/local/opt/python@3.8... /usr/bin/python3

从 Python 官方网站安装python-3.7.3后,我能够安装 numpy,看起来在 3.7.3 的环境中安装 numpy 没有任何问题。

UPDATE: (As of Oct 20, 2021) Python 3.10, released on Oct 4, 2021 is not compatible with MacOS11.更新:(截至 2021 年 10 月 20 日)2021 年 10 月 4 日发布的 Python 3.10 与 MacOS11 不兼容。 Errors in build process from scratch warn that "some code will never be executed."从头开始构建过程中的错误警告“某些代码将永远不会被执行”。 I suspect incompatibility between xcode and clang calls.我怀疑 xcode 和 clang 调用之间不兼容。 TBH, save yourself the heartbreak and go for the Anaconda/miniconda distros. TBH,不要让自己心碎,去 Anaconda/miniconda 发行版。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM