m1 python安装scipy失败

安装成功seaborn后,在import seaborn提示没有安装scipy包,于是便开始了不断安装失败的过程。

介绍下环境:mac m1芯片,miniforge,python38

尝试过的方法:

第一种:直接安装

pip install scipy
sudo conda pip install scipy

错误提示:

……
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

第二种:增加镜像源

pip3 install --pre -i https://pypi.anaconda.org/scipy-wheels-nightly/simple scipy

同样报错

第三种:在pycharm中安装

在pycharm配置号环境后,在【Pycharm】-【Perference】-【Project】-【Python Interpreter】

点击+号,查询scipy,点击install

报错:

Make sure that you use the correct version of 'pip' installed for your Python interpreter

第四种:下载包后安装(成功)

找到这篇文章,了解到可以自行从网络上下载包的方法。

安装Scipy失败 解决途径 - 知乎

(1)了解到安装的版本号

pip debug --verbose

得到

……

Compatible tags: 296
  cp38-cp38-macosx_11_0_arm64
  cp38-cp38-macosx_11_0_universal2
  cp38-cp38-macosx_10_16_universal2
  cp38-cp38-macosx_10_15_universal2
  cp38-cp38-macosx_10_14_universal2
  cp38-cp38-macosx_10_13_universal2
  cp38-cp38-macosx_10_12_universal2

……

具体参考Python 语法问题-module ‘pip‘ has no attribute ‘pep425tags‘,告诉你如何正确查看pip支持,32位、64位查看pip支持万能方法_小蓝枣的博客-CSDN博客_pip.pep425tags.get_supported()

(2)下载安装包

上述问题只提供了window的安装地址,未知mac安装包在下载。

在pycham的scipy的安装页面存在网址:https://www.scipy.org

进入这个页面,点击页面上方的【Download】-【PyPI page for SciPy (all)】-【Download files】可以看到所有scipy版本,单在页面中没有找到完全符合可用版本的包。

于是下载了一个近似的:

scipy-1.8.0-cp38-cp38-macosx_12_0_arm64.whl 

(3)安装

cd /Users/用户名/Downloads/chrome   //安装包所在位置
pip install scipy-1.8.0-cp38-cp38-macosx_12_0_arm64.whl

报错,提示版本不正确。

Defaulting to user installation because normal site-packages is not writeable
ERROR: scipy-1.8.0-cp38-cp38-macosx_12_0_arm64.whl is not a supported wheel on this platform.

于是从Compatible tags中挑选一个近似的cp38-abi3-macosx_11_0_arm64,修改下载的文件名为

scipy-1.8.0-cp38-abi3-macosx_11_0_arm64.whl

pip install scipy-1.8.0-cp38-abi3-macosx_11_0_arm64.whl

终于安装成功!! 

Defaulting to user installation because normal site-packages is not writeable
Processing ./scipy-1.8.0-cp38-abi3-macosx_11_0_arm64.whl
Requirement already satisfied: numpy<1.25.0,>=1.17.3 in /Users/buzhidao/miniforge3/envs/python38/lib/python3.8/site-packages (from scipy==1.8.0) (1.22.0)
Installing collected packages: scipy
Successfully installed scipy-1.8.0

 python新手,记录一次问题的解决,如有问题,欢迎大家指出。

你可能感兴趣的:(python,开发语言,后端)