我正在尝试在python 3.8中将pandas安装为pd,但出现连续错误

时间:2020-08-10 19:47:54

标签: python pandas import python-import python-3.8

我在Windows 10上使用pip版本20.2.1,并且我使用pip install pandas,它说我已经成功安装了pandas,但是当我尝试导入它时,它说这是一个未解决的导入,也给了我错误。

PS C:\WINDOWS\system32> & C:/Users/dannyz/AppData/Local/Programs/Python/Python38-32/python.exe "c:/Users/dannyz/Desktop/Python/Excel Automation.py"
Traceback (most recent call last):
  File "c:/Users/dannyz/Desktop/Python/Excel Automation.py", line 1, in <module>
    import pandas
  File "c:\Users\dannyz\Desktop\Python\pandas\__init__.py", line 11, in <module>
    __import__(dependency)
  File "c:\Users\dannyz\Desktop\Python\numpy\__init__.py", line 138, in <module>
    from . import _distributor_init
  File "c:\Users\dannyz\Desktop\Python\numpy\_distributor_init.py", line 26, in <module>
    WinDLL(os.path.abspath(filename))
  File "C:\Users\dannyz\AppData\Local\Programs\Python\Python38-32\lib\ctypes\__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

这是我的代码。

import pandas as pd

print("hello")

1 个答案:

答案 0 :(得分:0)

此问题是由程序路径冲突引起的; 您在两个不同的位置都有Python文件:

C:/ Users / dannyz / AppData / Local / Programs / Python / Python38-32 /

c:/ Users / dannyz / Desktop / Python /

我搜索了错误代码,并遇到了有关此GitHub线程here的问题。 似乎您需要在删除原始文件和/或移动已经拥有的python文件之后重新安装Python。确保备份所有要保留的程序。