解决python中导入win32com.client出错的问题

yipeiwu_com6年前Python基础

准备写一个操作Excel脚本却在导入包的时候出现了一个小问题

导入包

from Tkinter import Tk
from time import sleep, ctime
from tkMessageBox import showwarning
from urllib import urlopen
import win32com.client as win32

报错提示

Traceback (most recent call last):
 File "estock.pyw", line 7, in <module>
 import win32com.client as win32
ImportError: No module named win32com.client

解决方案

python -m pip install pypiwin32

安装后

>>> import win32com.client
>>>
>>>

问题成功解决!

以上这篇解决python中导入win32com.client出错的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

使用python提取html文件中的特定数据的实现代码

例如 具有如下结构的html文件 复制代码 代码如下: <div class='entry-content'> <p>感兴趣内容1</p> <p...

python实现从网络下载文件并获得文件大小及类型的方法

本文实例讲述了python实现从网络下载文件并获得文件大小及类型的方法。分享给大家供大家参考。具体实现方法如下: import urllib2 from settings impor...

收藏整理的一些Python常用方法和技巧

1. 逆转字符串的三种方法 1.1. 模拟C++中方法, 定义一个空字符串来实现 通过设置一个空字符串, 然后讲参数中的字符串从后往前遍历, 使用字符串的加法合并为新的字符串 复制代码...

Python中的startswith和endswith函数使用实例

在Python中有两个函数分别是startswith()函数与endswith()函数,功能都十分相似,startswith()函数判断文本是否以某个字符开始,endswith()函数判...

Python判断一个文件夹内哪些文件是图片的实例

如下所示: def is_img(ext): ext = ext.lower() if ext == '.jpg': return True elif ext == '.p...