【问题标题】:Pandas Import Fails with Conda on Python 3.7.9在 Python 3.7.9 上使用 Conda 导入 Pandas 失败
【发布时间】:2021-02-13 21:32:26
【问题描述】:

我已经安装了 conda 并创建了一个 python3.7 环境。然后我安装了pandas,现在当我尝试导入pandas 时出现以下错误。

Traceback (most recent call last):
  File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/__init__.py", line 29, in <module>
  File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/__init__.py", line 13, in <module>
ImportError: /me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/interval.cpython-37m-x86_64-linux-gnu.so: invalid ELF header

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

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/__init__.py", line 37, in <module>
ImportError: C extension: /me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/interval.cpython-37m-x86_64-linux-gnu.so: invalid ELF header 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.Traceback (most recent call last):
  File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/__init__.py", line 29, in <module>
  File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/__init__.py", line 13, in <module>
ImportError: /me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/interval.cpython-37m-x86_64-linux-gnu.so: invalid ELF header

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

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/__init__.py", line 37, in <module>
ImportError: C extension: /me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/interval.cpython-37m-x86_64-linux-gnu.so: invalid ELF header 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.

有什么想法吗?

【问题讨论】:

  • 你是如何安装pandas的?显然,没有为您的系统正确构建 C 扩展。您使用的是 32 位还是 64 位版本的 Python?
  • 按照熊猫安装指南中的描述使用conda install pandas
  • 另外,当它是活动环境时,您是否尝试在新环境中运行代码?

标签: python pandas conda


【解决方案1】:

原来这是condapandas 的错误。

这是门票: BUG: Pandas Import is failing under Conda Python 3.7

使用conda-forge 为我解决了这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-03
    • 2016-08-28
    • 2019-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-06
    相关资源
    最近更新 更多