简体   繁体   English

ImportError导入袖扣时没有名为“ plotlytools”的模块

[英]ImportError No module named 'plotlytools' when importing Cufflinks

My system environment: Windows 8.1, WinPython 3.4.3.1, pandas 0.16, plotly 1.6.14, cufflinks 0.2 我的系统环境: Windows 8.1, WinPython 3.4.3.1, pandas 0.16, plotly 1.6.14, cufflinks 0.2

I have no idea what's causing the issue. 我不知道是什么原因造成的。 I'm attempting to use the tutorial outlined here cufflinks nbviewer tutorial 我正在尝试使用此处概述的教程袖扣nbviewer教程

However when I try to import the cufflinks module I get the following output. 但是,当我尝试导入袖扣模块时,得到以下输出。

在此处输入图片说明

That doesn't make sense to me because as far as I can tell the files are all set up correctly within the folder and I don't see any obvious errors within the files themselves. 这对我来说没有任何意义,因为据我所知,所有文件均已在文件夹中正确设置,并且我看不到文件本身内有任何明显的错误。 See below image: 见下图:

在此处输入图片说明

I also looked at the __init__.py file and didn't see anything unusual. 我还查看了__init__.py文件,没有发现任何异常。

在此处输入图片说明

And lastly I looked at the actual plotlytools.py file to see if anything looked odd and nothing jumped out at me. 最后,我查看了实际的plotlytools.py文件,看是否有什么奇怪的地方,而且没有任何东西跳出来。

在此处输入图片说明

Any help figuring this one out would be greatly appreciated. 任何帮助弄清楚这一点将不胜感激。 Thanks. 谢谢。

UPDATE: If this helps here is a print out of my sys.path 更新:如果这有帮助,请打印我的sys.path

在此处输入图片说明

I was able to import the module after implementing the following workarounds: 在实施以下解决方法后,我能够导入该模块:

  1. In the utils.py file I added () to all the print statements, example: print 'string' became print('string') . utils.py文件中,我将()添加到所有print语句中,例如: utils.py print 'string'变为print('string')
  2. I copied then deleted the utils.py and colors.py files and pasted the contents into the plotlytools.py file. 我复制然后删除了utils.pycolors.py文件,并将内容粘贴到plotlytools.py文件中。
  3. I updated all the import references in the remaining files. 我更新了其余文件中的所有导入参考。
  4. to use the pandastools functionality, specifically the df.iplot method, it was also necessary to update the encoding and decoding methods for the colors.py file from str.encode('hex') and str.decode('hex') to import codecs; codecs.encode(str,'hex'); codecs.decode(str,'hex') 要使用pandastools功能,特别是df.iplot方法,还需要从str.encode('hex') and str.decode('hex')更新colors.py文件的编码和解码方法以进行import codecs; codecs.encode(str,'hex'); codecs.decode(str,'hex') import codecs; codecs.encode(str,'hex'); codecs.decode(str,'hex')
  5. I also updated the generator methods from gen_object.next() to next(gen_object) 我还将生成器方法从gen_object.next()更新为next(gen_object)

At this point all the functionality of the module seems to be restored. 此时,该模块的所有功能似乎已恢复。

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

相关问题 ImportError:导入dogtail时没有名为gconf的模块 - ImportError: No module named gconf when importing dogtail ImportError:导入mechanize时没有名为'_version'的模块 - ImportError: No module named '_version' when importing mechanize ModuleNotFoundError:没有名为“袖扣”的模块 - ModuleNotFoundError: No module named 'cufflinks' 导入我自己的模块时出现“ImportError: No module named...” - “ImportError: No module named…” when importing my own module ImportError:导入我自己的子包时没有名为“”的模块 - ImportError: No module named '' when importing my own sub-package ImportError: No module named error when importing urllib.error 错误 - ImportError: No module named error when importing urllib.error 跨包导入模块时,Python“ ImportError:未命名模块” - Python 'ImportError: No module named' when importing modules across packages ImportError:导入swampy.TurtleWorld时没有名为Tkinter的模块 - ImportError: No module named Tkinter when importing swampy.TurtleWorld ImportError:当模块在那里时,没有模块被命名 - ImportError: No module named when module is there 导入橙色返回“ImportError:没有名为orange的模块” - Importing Orange returns “ImportError: no module named orange”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM