本文介绍了ImportError:没有名为lib的模块.无法导入 pandas ,numpy,scipy,matplotlib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近更新了许多软件包和我的EPD Canopy版本(至1.4.1.1975),现在我无法导入pandasnumpyscipymatplotlib.我得到下面的ImportError.我也尝试过从命令提示符导入,但是我可以遇到同样的错误.

I recently updated a number of packages and my version of EPD Canopy (to1.4.1.1975) and now I'm unable to import pandas, numpy, scipy or matplotlib. I get the ImportError below. I've also tried importing from the command prompt but I can the same error.

pandas-0.14.0-1numpy-1.8.0-2scipy-0.14.0-1matplotlib-1.3.1-8

pandas - 0.14.0-1numpy - 1.8.0-2scipy - 0.14.0-1matplotlib - 1.3.1-8

有人对我如何解决此问题有任何建议吗? 从这个Stackoverflow问题看来,我可能需要更改/移动东西到另一个目录.有人可以解释一下我该怎么做吗?建议使用此文档,但我不确定如何适应此情况.

Does anybody have any suggestions as to how I could fix this? From this Stackoverflow question it seems like I might need to change/move something to a different directory. Could somebody explain how I could go about this? This documentation was suggested but I'm not sure how to adapt this for my situation.

import pandas as pd

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-af55e7023913> in <module>()
----> 1 import pandas as pd

C:\Users\AppData\Local\Enthought\Canopy32\User\lib\site-packages\pandas\__init__.py in <module>()
     10     print(e)
     11     if 'No module named lib' in str(e):
---> 12         raise ImportError('C extensions not built: if you installed already '
     13                           'verify that you are not importing from the source '
     14                           'directory')

ImportError: C extensions not built: if you installed already verify that you are not importing from the source directory

No module named lib

推荐答案

Canopy User Python环境中的某些东西似乎已损坏.最简单的解决方案是删除该目录:

Looks like something in your Canopy User Python environment has gotten corrupted. Easiest solution would be to delete this directory:

C:\Users\AppData\Local\Enthought\Canopy32\User\

(您确定是吗?通常您的用户名应介于Users\AppData之间.或者您只是出于隐私目的将其删除了?)–在这种情况下,最好将其替换为您的用户名消息,并带有<my user name>以避免混淆.)

(are you sure that's it?? Normally your user name would be between Users\ and AppData. Or did you just remove that from your question for privacy? -- in that case, better to replace it in your message with <my user name> to avoid confusion.)

,然后重新启动Canopy.您已经更新或安装的所有程序包都需要重新安装(当然,对于Canopy 1.4.1中已经更新的程序包,当然很多.)

and then restart Canopy. Any packages that you have updated or installed will need to be re-installed (except of course for the ones that were already updated in Canopy 1.4.1, which is very many.)

这篇关于ImportError:没有名为lib的模块.无法导入 pandas ,numpy,scipy,matplotlib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 19:15
查看更多