首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >导入熊猫模块时MacPython3.8 IntelliJ错误

导入熊猫模块时MacPython3.8 IntelliJ错误
EN

Stack Overflow用户
提问于 2022-04-13 18:41:10
回答 1查看 212关注 0票数 0

在我的苹果M1芯片机上,试图导入熊猫模块中的IntelliJ思想。在运行这个程序时,它给出了以下错误。

如果我在命令行中运行相同的程序,它就能工作。在IDE中运行时遇到此问题。

对解决此错误消息有帮助吗?

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

从此输出中移除我的home dir:

误差

代码语言:javascript
运行
复制
Traceback (most recent call last):
  File "panda-test01.py", line 9, in <module>
    import pandas as pd
  File "Library/Python/3.8/lib/python/site-packages/pandas/__init__.py", line 16, in <module>
    raise ImportError(
ImportError: Unable to import required dependencies:
numpy: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.8 from "/Library/Developer/CommandLineTools/usr/bin/python3"
  * The NumPy version is: "1.22.3"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: dlopen(Library/Python/3.8/lib/python/site-packages/numpy/core/_multiarray_umath.cpython-38-darwin.so, 0x0002): tried: 'Library/Python/3.8/lib/python/site-packages/numpy/core/_multiarray_umath.cpython-38-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

谢谢

EN

回答 1

Stack Overflow用户

发布于 2022-04-13 19:06:19

从您的错误消息:(mach-o文件,但是一个不兼容的体系结构(有‘arm64,需要'x86_64'))

这有点含糊不清,因为它可以用任何一种方式来解释,但我认为这意味着IntelliJ在X86模式下使用Rosetta2运行,而python路径的numpy/大熊猫安装是您的arm版本。(另一种选择是相反的,但这种情况更有可能发生)。

为了运行您的程序,您需要创建一个使用Rosetta2并安装X86二进制文件而不是arm的python环境。我曾经写过如何做这个这里,作为我自己的参考。然后IntelliJ应该有一个设置来指定用于执行和调试的python环境,您应该将该环境/路径设置为新的X86环境。

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

https://stackoverflow.com/questions/71862433

复制
相关文章

相似问题

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