熊猫在PyCharm上抛出OSError

时间:2019-06-26 09:59:32

标签: python pandas winapi jetbrains-ide

我的PyCharm出现以下错误:

Traceback (most recent call last):
  File "C:/Users/security/Downloads/AP/Boston-Kaggle/Boston.py", line 1, in <module>
    import pandas as pd
  File "C:\Users\security\AppData\Roaming\Python\Python37\site-packages\pandas\__init__.py", line 13, in <module>
    __import__(dependency)
  File "C:\Users\security\AppData\Roaming\Python\Python37\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "C:\Users\security\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py", line 23, in <module>
    WinDLL(os.path.abspath(filename))
  File "C:\Users\security\Anaconda3\lib\ctypes\__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

是因为我导入了熊猫:

import pandas as pd

根据有关类似S / O帖子的建议,我已卸载Anaconda并重新安装。我也尝试过卸载/重新安装pandas,但没有任何效果。

1 个答案:

答案 0 :(得分:0)

***\core\__init__.py: line23中,初始化脚本会加载位于您的路径"C:\Users\security\AppData\Roaming\Python\Python37\site-packages\numpy\.libs\*openblas*dll"中的dll,如果您将32位DLL与64位Python配合使用,反之亦然,那么您可能会得到错误。 我建议尝试使用Anaconda在同一位加载DLL(从Numpy下载)。