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

yipeiwu_com5年前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(Tornado)模拟登录小米抢手机

Python(Tornado)模拟登录小米抢手机

今天看到同事参与小米的抢购,几经数个星期的尝试,终于抢到了一台小米电视……看了一下小米的抢购流程,似乎可以用程序可破。于是想写点东西玩玩(你懂的……),第一步肯定是先得模拟登录小米帐号,...

Python不规范的日期字符串处理类

我分析了形如19920203、199203、1992.02.03、1992.02、1992-02-03、1992-02、920203时间格式特征,列出了正则表达式如下:复制代码 代码如下...

python linecache 处理固定格式文本数据的方法

小程序大功能 对一批报文要处理要处理里面的得分,发现python linecache ,特记录如下。 #!/usr/bin/env python # -*- coding: utf-...

Python中的单行、多行、中文注释方法

Python中的单行、多行、中文注释方法

一、python单行注释符号(#) python中单行注释采用 #开头 示例:#this is a comment 二、批量、多行注释符号 多行注释是用三引号”' ”'包含的,例如:...

Python中的self用法详解

Python中的self用法详解

在Python类中规定,函数的第一个参数是实例对象本身,并且约定俗成,把其名字写为self。其作用相当于java中的this,表示当前类的对象,可以调用当前类中的属性和方法。 class...