开发者社区> 问答> 正文

帮忙:windows安装pywin32不成功:报错

自己想写一个可以读取windows服务器的cpu、内存、硬盘等信息的功能,需要使用到wmi

我安装了wmi,但是它依赖于win32com.client模块下的函数,我从sf官网下载了D:\pywin32-218

当我执行python setup.py install的时候就报错误了:

Building pywin32 2.7.218.0
Traceback (most recent call last):
  File "setup.py", line 1957, in <module>
    """ % dirs).split(),
  File "setup.py", line 605, in __init__
    if os.path.isfile(os.path.join(sdk_dir, "include", "activdbg.h")):
  File "D:\Python27\lib\ntpath.py", line 64, in join
    result_drive, result_path = splitdrive(path)
  File "D:\Python27\lib\ntpath.py", line 114, in splitdrive
    if len(p) > 1:
TypeError: object of type 'NoneType' has no len()



展开
收起
kun坤 2020-06-07 22:29:03 526 0
1 条回答
写回答
取消 提交回答
  • setup.py文件的 line 1957是这样的

    WinExt_win32com_axdebug('axdebug',
                libraries="axscript",
                pch_header="stdafx.h",
                sources=("""
                        %(axdebug)s/AXDebug.cpp
                        %(axdebug)s/PyIActiveScriptDebug.cpp
                        %(axdebug)s/PyIActiveScriptErrorDebug.cpp
                        %(axdebug)s/PyIActiveScriptSiteDebug.cpp
                        %(axdebug)s/PyIApplicationDebugger.cpp
                        %(axdebug)s/PyIDebugApplication.cpp
                        %(axdebug)s/PyIDebugApplicationNode.cpp
                        %(axdebug)s/PyIDebugApplicationNodeEvents.cpp
                        %(axdebug)s/PyIDebugApplicationThread.cpp
                        %(axdebug)s/PyIDebugCodeContext.cpp
                        %(axdebug)s/PyIDebugDocument.cpp
                        %(axdebug)s/PyIDebugDocumentContext.cpp
                        %(axdebug)s/PyIDebugDocumentHelper.cpp
                        %(axdebug)s/PyIDebugDocumentHost.cpp
                        %(axdebug)s/PyIDebugDocumentInfo.cpp
                        %(axdebug)s/PyIDebugDocumentProvider.cpp
                        %(axdebug)s/PyIDebugDocumentText.cpp
                        %(axdebug)s/PyIDebugDocumentTextAuthor.cpp
                        %(axdebug)s/PyIDebugDocumentTextEvents.cpp
                        %(axdebug)s/PyIDebugDocumentTextExternalAuthor.cpp
                        %(axdebug)s/PyIDebugExpression.cpp
                        %(axdebug)s/PyIDebugExpressionCallBack.cpp
                        %(axdebug)s/PyIDebugExpressionContext.cpp
                        %(axdebug)s/PyIDebugProperties.cpp
                        %(axdebug)s/PyIDebugSessionProvider.cpp
                        %(axdebug)s/PyIDebugStackFrame.cpp
                        %(axdebug)s/PyIDebugStackFrameSniffer.cpp
                        %(axdebug)s/PyIDebugStackFrameSnifferEx.cpp
                        %(axdebug)s/PyIDebugSyncOperation.cpp
                        %(axdebug)s/PyIEnumDebugApplicationNodes.cpp
                        %(axdebug)s/PyIEnumDebugCodeContexts.cpp
                        %(axdebug)s/PyIEnumDebugExpressionContexts.cpp
                        %(axdebug)s/PyIEnumDebugPropertyInfo.cpp
                        %(axdebug)s/PyIEnumDebugStackFrames.cpp
                        %(axdebug)s/PyIEnumRemoteDebugApplications.cpp
                        %(axdebug)s/PyIEnumRemoteDebugApplicationThreads.cpp
                        %(axdebug)s/PyIMachineDebugManager.cpp
                        %(axdebug)s/PyIMachineDebugManagerEvents.cpp
                        %(axdebug)s/PyIProcessDebugManager.cpp
                        %(axdebug)s/PyIProvideExpressionContexts.cpp
                        %(axdebug)s/PyIRemoteDebugApplication.cpp
                        %(axdebug)s/PyIRemoteDebugApplicationEvents.cpp
                        %(axdebug)s/PyIRemoteDebugApplicationThread.cpp
                        %(axdebug)s/stdafx.cpp
                         """ % dirs).split(),
        ),



    ######说实话这PYTHON安装扩展的时候各种BUG各种异常各种版本不兼容.早就把这货扔到垃圾桶进去了######用pyutil吧###### 从源码build有问题的话,试试替代方案吧:
    1. 可以用sf官网的exe安装包
    2. 可以用pypiwin32
    2020-06-07 22:29:17
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
《云服务器运维之Windows篇》 立即下载
TAKING WINDOWS 10 KERNEL 立即下载
ECS运维指南之Windows系统诊断 立即下载