首页 > 解决方案 > 为什么会出错?%1 不是有效的 Win32 应用程序

问题描述

我正在尝试运行一个简单的程序,但出现以下错误。我在 PyCharm、Python 3.8 和 Windows 上运行它。如果我不导入 Pandas,代码运行不会出错。

import pandas

def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.


# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    print_hi('PyCharm')

Traceback (most recent call last):
  File "C:/Users/pmodi/Documents/Python3/Trial123/main.py", line 1, in <module>
    import pandas
  File "C:\Users\pmodi\AppData\Roaming\Python\Python38\site-packages\pandas\__init__.py", line 11, in <module>
    __import__(dependency)
  File "C:\Users\pmodi\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py", line 138, in <module>
    from . import _distributor_init
  File "C:\Users\pmodi\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py", line 26, in <module>
    WinDLL(os.path.abspath(filename))
  File "C:\Users\pmodi\Anaconda3\envs\Trial123\lib\ctypes\__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

Process finished with exit code 1

标签: python

解决方案


推荐阅读