pandas 的conda版本不匹配 [英] conda version of pandas mismatch

查看:174
本文介绍了 pandas 的conda版本不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Anaconda套件用于python.我会

I use the Anaconda suite for python. I do

import pandas as pd

然后

pd.show_versions()

它显示

大熊猫:0.17.1

pandas: 0.17.1

但如果我这样做

!conda list

它显示

熊猫0.18.1

pandas 0.18.1

为什么这些不同?为什么导入的熊猫版本不如conda版本更新?在此阶段,某些属性对我不起作用(例如.rolling),这很麻烦.
我已经尝试过
conda update pandas
然后重新启动spyder,但没有任何运气

Why are those different ? Why is the imported pandas version less up to date than the one in conda ? Some attributes do not work for me at this stage (like .rolling) which is a great hassle.
I've already tried
conda update pandas
and then restart spyder, but without any luck

非常感谢您的帮助

---- pd.__file__返回

输出[16]:'C:\ Anaconda3 \ lib \ site-packages \ pandas \ __ init__.py'

Out[16]: 'C:\Anaconda3\lib\site-packages\pandas\__init__.py'

sys.executable返回

'C:\ Anaconda3 \ python.exe'

'C:\Anaconda3\python.exe'

我尝试了sys.path返回

输出[15]:['','C:\ Anaconda3 \ python35.zip','C:\ Anaconda3 \ DLLs',
'C:\ Anaconda3 \ lib','C:\ Anaconda3',
'c:\ anaconda3 \ lib \ site-packages \ setuptools-23.0.0-py3.5.egg',
'C:\ Anaconda3 \ lib \ site-packages',
'C:\ Anaconda3 \ lib \ site-packages \ Sphinx-1.4.1-py3.5.egg',
'C:\ Anaconda3 \ lib \ site-packages \ win32',
'C:\ Anaconda3 \ lib \ site-packages \ win32 \ lib',
'C:\ Anaconda3 \ lib \ site-packages \ Pythonwin',
'C:\ Anaconda3 \ lib \ site-packages \ IPython \ extensions',
'C:\ Users \ jeanbaptiste.lepetit \ .ipython',
'C:\ Anaconda3 \ lib \ site-packages \ IPython \ extensions',
'C:\ Anaconda3 \ lib \ site-packages \ IPython \ extensions']

Out[15]: ['', 'C:\Anaconda3\python35.zip', 'C:\Anaconda3\DLLs',
'C:\Anaconda3\lib', 'C:\Anaconda3',
'c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg',
'C:\Anaconda3\lib\site-packages',
'C:\Anaconda3\lib\site-packages\Sphinx-1.4.1-py3.5.egg',
'C:\Anaconda3\lib\site-packages\win32',
'C:\Anaconda3\lib\site-packages\win32\lib',
'C:\Anaconda3\lib\site-packages\Pythonwin',
'C:\Anaconda3\lib\site-packages\IPython\extensions',
'C:\Users\jeanbaptiste.lepetit\.ipython',
'C:\Anaconda3\lib\site-packages\IPython\extensions',
'C:\Anaconda3\lib\site-packages\IPython\extensions']

pd.__version__返回

'0.17.1'

'0.17.1'

这很令人困惑

----------编辑2 ----------------
好吧,我想把包裹放在两个地方

----------EDIT 2 ----------------
Ok I figures packages where at two places

C:\ Anaconda3 \ lib \ site-packages \ pandas

C:\ Anaconda3 \ pkgs \ pandas-0.18.1-np110py35_0 \ Lib \ site-packages \ pandas

C:\Anaconda3\lib\site-packages\pandas
and
C:\Anaconda3\pkgs\pandas-0.18.1-np110py35_0\Lib\site-packages\pandas

我手动删除了第一个,以查看会发生什么.然后尝试导入包:import pandas as pd,但找不到它.尝试conda install pandas返回

I manually deleted the first one to see what would happen. then try to import the package : import pandas as pd but it couldn't find it. Trying conda install pandas returns

已安装所有请求的软件包. C:\ Anaconda3中的环境中的软件包: 熊猫0.18.1 np110py35_0

All requested packages already installed. packages in environment at C:\Anaconda3: pandas 0.18.1 np110py35_0

所以我想所有conda命令都在该文件夹中,但import不起作用.我试图将`C:\ Anaconda3 \ pkgs'添加到PATH,但是没有运气.

So I guess it is in this folder that all the conda command go, but import doesn't work. I've tried to add `C:\Anaconda3\pkgs' to the PATH, but with no luck.

有什么主意吗?

推荐答案

最终,摆弄上面的所有答案并查看其他stackoverflow问题,我发现'pip-installed-packages'不会与'conda-installed-packages'.通常,pip插入的路径为C:\ Anaconda3 \ Lib \ site-packages,而conda的安装路径为C:\ Anaconda3 \ pkgs.

Eventually, fiddling with all the above answers and looking at other stackoverflow questions, I figured that 'pip-installed-packages' would not go in the same directory as 'conda-installed-packages'. Typically, pip-instlled go to C:\Anaconda3\Lib\site-packages while conda-installed go to C:\Anaconda3\pkgs.

我从C:\ Anaconda3 \ Lib \ site-packages中手动删除了'pandas'文件夹,但是由于某些原因,即使在我添加了'C:\ Anaconda3 \之后,Python也无法找到剩余的由conda安装的pandas软件包. pkgs"到路径

I removed manually the 'pandas' folder from C:\Anaconda3\Lib\site-packages, but for some reason, Python was unable to find the remaining conda-installed pandas package even after I added 'C:\Anaconda3\pkgs' to the PATH

最终,我在PATH中添加了一个特殊的硬代码,在PATH中添加了'C:\ Anaconda3 \ pkgs \ pandas-0.18.1-np110py35_0 \ Lib \ site-packages',并且它起作用了(对于此程序包位于至少)

Eventually I went for an ad-hoc hardcode to the PATH an added 'C:\Anaconda3\pkgs\pandas-0.18.1-np110py35_0\Lib\site-packages' to the PATH and it worked (for this package at least)

我不向自己解释的是python如何查找其他由conda安装的软件包(这些软件包没有像我对大熊猫所做的那样经过硬编码的特定"路径.

What I don't explain to myself is how python manages to find other conda-installed packages (packages for which there is no "specific" path hardcoded as I've done for pandas.

这篇关于 pandas 的conda版本不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆