繁体   English   中英

肯定已安装,但未导入Python-2.7模块

[英]A module of Python-2.7 not getting imported when it is definitely installed

我的熊猫包装没有被进口。 当我尝试使用以下命令检查我是否有大熊猫时

python -c "import pandas"

它显示了一些奇怪的错误,例如

<module 'numpy' from 'numpy.pyc'>
'module' object has no attribute 'dtype'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/pandas/__init__.py", line 6, in   <module>
from . import hashtable, tslib, lib
File "numpy.pxd", line 157, in init pandas.hashtable    (pandas/hashtable.c:21706)
AttributeError: 'module' object has no attribute 'dtype'

您将导入一个名为numpy.py本地文件,而不是全局安装的NumPy项目:

<module 'numpy' from 'numpy.pyc'>

删除或重命名该文件,然后删除该文件旁边的关联numpy.pyc文件。 你的本地文件没有名称dtype ,只有numpy 软件包安装在您的site-packages呢,但是当你的文件第一次每一次发现它无法加载。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM