在重新安装Python之后没有找到熊猫模块。

时间:2022-05-16 12:22:20

after making some changes on my system Python can no longer find Pandas. I'll first cover off the error and then what I've tried to correct the issue.

在对我的系统做了一些改变之后,Python再也找不到熊猫了。我先来掩饰错误,然后我试图纠正这个问题。

Error - If I'm reading this correctly Python.exe cannot find pandas... System - Hyper-v 2016, Python 3.5.4, Pandas 0.23 installed to c:\Python35.

错误——如果我读的是正确的Python。exe找不到大熊猫……系统-超v 2016, Python 3.5.4,熊猫0.23安装到c:\Python35。

Issue - there were previous instances of Python installed in different locations. I removed these and deleted directories C:\Program Files etc prior to installing 3.5.4 but I suspect there's a reference somewhere.

问题—以前有Python安装在不同位置的实例。在安装3.5.4之前,我删除了这些并删除了目录c:),但我怀疑在某处有一个引用。

Troubleshooting.

故障排除。

Is recognizing the right version

认识到正确的版本吗?

`C:\Python35>python
Python 3.5.4 (v3.5.4:3f56838, Aug  8 2017, 02:17:05) [MSC v.1900 64 bit         (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.r`

System is seeing right location

系统看到了正确的位置。

import os, sys
folder=os.path.dirname(sys.executable)
print(folder)here

OTHER

其他

I have tried reinstalling pandas with pip install --ignore-installed pandas which says it completes successfully.

我试过用pip安装来重新安装熊猫,但它成功的完成了。

I have inspected the directory C:\Python35\Lib\site-packages\pandas\core . All *.py files mentioned in the error exist.

我已经检查过了目录C:\Python35\Lib\site-package \大熊猫\core。所有的*。错误中提到的py文件存在。

The script I am running works on a W10 machine with P3.5.4 installed to c:\Python35.

我正在运行的脚本在W10机器上运行,P3.5.4安装到c:\Python35。

The pip freeze command shows pandas 0.23.0 is installed

pip冻结命令显示熊猫0.23.0安装。

Any tips on how to troubleshoot appreciated

任何关于如何排除故障的提示。

ERROR

错误

Traceback (most recent call last):
File "D:\SQL\Script\Python\ASXList.py", line 4, in <module>
import pandas as pd
File "C:\Python35\lib\site-packages\pandas\__init__.py", line 42, in <module>
from pandas.core.api import *
File "C:\Python35\lib\site-packages\pandas\core\api.py", line 10, in <module>
from pandas.core.groupby.groupby import Grouper
File "C:\Python35\lib\site-packages\pandas\core\groupby\__init__.py", line 2, in <module>
from pandas.core.groupby.groupby import (
File "C:\Python35\lib\site-packages\pandas\core\groupby\groupby.py", line 49, in <module>
from pandas.core.frame import DataFrame
File "C:\Python35\lib\site-packages\pandas\core\frame.py", line 74, in <module>
from pandas.core.series import Series
File "C:\Python35\lib\site-packages\pandas\core\series.py", line 3978, in <module>
Series._add_series_or_dataframe_operations()
File "C:\Python35\lib\site-packages\pandas\core\generic.py", line 8891, in _add_series_or_dataframe_operations
from pandas.core import window as rwindow
File "C:\Python35\lib\site-packages\pandas\core\window.py", line 36, in <module>
import pandas._libs.window as _window
ImportError: DLL load failed: The specified module could not be found.

2 个解决方案

#1


1  

Edit:

编辑:

The error seems to be with pandas .23 do the following in the command prompt.

错误似乎与熊猫有关。23在命令提示中执行以下操作。

pip uninstall pandas
pip install pandas == 0.22

https://github.com/pandas-dev/pandas/issues/21106

https://github.com/pandas-dev/pandas/issues/21106

#2


1  

Try adding the path that contains the pandas module to PYTHONPATH environment variable. For example, if pandas is at C:\Python35, then set the environment variable to that path. Then when you run python again, the interpreter will know where to look for the pandas module.

尝试将包含熊猫模块的路径添加到PYTHONPATH环境变量中。例如,如果熊猫在C:\Python35,那么将环境变量设置为该路径。然后,当您再次运行python时,解释器将知道在哪里寻找熊猫模块。

Instruction on setting the environment variable can be found at https://www.codingdefined.com/2015/09/how-to-set-up-pythonpath-in-windows-10.html

设置环境变量的指令可以在https://www.codingdefined.com/2015/09/howto -set-up- pythonpathins -10.html中找到。

#1


1  

Edit:

编辑:

The error seems to be with pandas .23 do the following in the command prompt.

错误似乎与熊猫有关。23在命令提示中执行以下操作。

pip uninstall pandas
pip install pandas == 0.22

https://github.com/pandas-dev/pandas/issues/21106

https://github.com/pandas-dev/pandas/issues/21106

#2


1  

Try adding the path that contains the pandas module to PYTHONPATH environment variable. For example, if pandas is at C:\Python35, then set the environment variable to that path. Then when you run python again, the interpreter will know where to look for the pandas module.

尝试将包含熊猫模块的路径添加到PYTHONPATH环境变量中。例如,如果熊猫在C:\Python35,那么将环境变量设置为该路径。然后,当您再次运行python时,解释器将知道在哪里寻找熊猫模块。

Instruction on setting the environment variable can be found at https://www.codingdefined.com/2015/09/how-to-set-up-pythonpath-in-windows-10.html

设置环境变量的指令可以在https://www.codingdefined.com/2015/09/howto -set-up- pythonpathins -10.html中找到。