ImportError: cannot import name 'Workbook' using from xlwings import Workbook

时间秒杀一切 提交于 2019-12-11 13:20:02

问题


I am using xlwings to write and read data from Excel files using python 3.4 (Anaconda package). I installed xlwings with

pip install xlwings

Update: I realized that I might not have given enough info about what I am trying to do. So here it is: I am writing my code in the editor called Spyder. What I usually do is, I put the "import commands" at the beginning of my code. However, when I run the code, the "import command" for xlwings would not work and gives me the "ImportError" I am taking about below. Interestingly, what I found out later: if I save the code (my program) in my home directory it will execute the import command without problems. I also have no problems if I import xlwings in the python console in my spyder editor (which is again home directory), which then allows me to run my code even if is is not saved in my home directory. I am puzzeled..

When I execute

from xlwings import Workbook

in my Python consol (Spyder) the programm runs fine. But once I am trying to run only the program without "priming" it, it gives me the following error message

ImportError: cannot import name 'Workbook'

I wonder what to do to get around this?

As a side note, about a year ago someone else was posting that there is a problem importing the xlwings module 'Workbook' using python 3.4. The fix was using

from xlwings.xlwings import Workbook

which unfortunately does not work for me.

Thank you for any help!

来源:https://stackoverflow.com/questions/32952304/importerror-cannot-import-name-workbook-using-from-xlwings-import-workbook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!