首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在苹果M1芯片上导入熊猫

如何在苹果M1芯片上导入熊猫
EN

Stack Overflow用户
提问于 2021-01-04 22:49:40
回答 4查看 8.6K关注 0票数 4

当我调用时:

代码语言:javascript
运行
复制
import pandas as pd

tensorflow_macos上(用于M1芯片)

我得到了:

代码语言:javascript
运行
复制
ImportError                               Traceback (most recent call last)
~/tensorflow_macos_venv/lib/python3.8/site-packages/pandas/__init__.py in <module>
     28 try:
---> 29     from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
     30 except ImportError as e:  # pragma: no cover

~/tensorflow_macos_venv/lib/python3.8/site-packages/pandas/_libs/__init__.py in <module>
     12 
---> 13 from pandas._libs.interval import Interval
     14 from pandas._libs.tslibs import (

ImportError: dlopen(/Users/ashkan/tensorflow_macos_venv/lib/python3.8/site-packages/pandas/_libs/interval.cpython-38-darwin.so, 2): no suitable image found.  Did find:
    /Users/ashkan/tensorflow_macos_venv/lib/python3.8/site-packages/pandas/_libs/interval.cpython-38-darwin.so: mach-o, but wrong architecture
    /Users/ashkan/tensorflow_macos_venv/lib/python3.8/site-packages/pandas/_libs/interval.cpython-38-darwin.so: mach-o, but wrong architecture

The above exception was the direct cause of the following exception:

ImportError                               Traceback (most recent call last)
<ipython-input-3-94f55571b0d6> in <module>
      1 import numpy as np
----> 2 import pandas as pd
      3 
      4 import matplotlib.pyplot as plt
      5 

~/tensorflow_macos_venv/lib/python3.8/site-packages/pandas/__init__.py in <module>
     31     # hack but overkill to use re
     32     module = str(e).replace("cannot import name ", "")
---> 33     raise ImportError(
     34         f"C extension: {module} not built. If you want to import "
     35         "pandas from the source directory, you may need to run "

ImportError: C extension: dlopen(/Users/ashkan/tensorflow_macos_venv/lib/python3.8/site-packages/pandas/_libs/interval.cpython-38-darwin.so, 2): no suitable image found.  Did find:
    /Users/ashkan/tensorflow_macos_venv/lib/python3.8/site-packages/pandas/_libs/interval.cpython-38-darwin.so: mach-o, but wrong architecture
    /Users/ashkan/tensorflow_macos_venv/lib/python3.8/site-packages/pandas/_libs/interval.cpython-38-darwin.so: mach-o, but wrong architecture not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --force' to build the C extensions first.
EN

Stack Overflow用户

发布于 2021-01-04 22:55:37

如下一篇文章(https://github.com/apple/tensorflow_macos/issues/6)所示,似乎解决方案是从conda安装pandas,直到它们解决这个问题。

要安装pandas,请执行以下操作:

代码语言:javascript
运行
复制
conda install pandas

或者直接从源代码安装:https://github.com/pandas-dev/pandas#installation-from-sources

票数 1
EN
查看全部 4 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65564673

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档