Tag Archives: ImportError: No module named win32com.client

Python ImportError: No module named win32com.client [How to Solve]

Error in Python: importerror: no module named win32com.client

[questions]

[solved] processing operation in Python chart in Excel

Use the code:

#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Function:
[Solved] Handling charts in Excel in Python (Chart, Graph)

【已解决】Python中处理操作Excel中的图表(Chart,Graph)
Author: Crifan Li Version: 2012-12-25 Contact: admin at crifan dot com """ from win32com.client import Dispatch; def excelChart(): ex = Dispatch("Excel.Application"); print "ex=",ex; if __name__ == "__main__": excelChart();

The result runs with the error.

D:\tmp\tmp_dev_root\python\excel_chart>excel_chart.py

Traceback (most recent call last):

File “D:\tmp\tmp_dev_root\python\excel_chart\excel_chart.py”, line 13, in <module>

from win32com.client import Dispatch;

ImportError: No module named win32com.client

[Solution Process

1. Reference.

http://sourceforge.net/projects/pywin32/

Find

http://sourceforge.net/projects/pywin32/files/pywin32/

in the latest

http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/

Then go and download the corresponding version.

Here I have Win7 64-bit + Python 2.7.3

So it is.

pywin32-218.win-amd64-py2.7.exe

2. After downloading, get pywin32-218.win-amd64-py2.7.exe and go to install: pywin32-218.win-amd64-py2.7.exe.

3. After installation, go try the code again and it will be normal:.

D:\tmp\tmp_dev_root\python\excel_chart>excel_chart.py

ex= Microsoft Excel

[Summary]

Win32com.client corresponds to the library Pywin32, which is installed and ready to use.