无法让 pywin32-219 使用 python 3.5

Can't get pywin32-219 to work with python 3.5

似乎使用 EXE 安装没有错误(在我的例子中是 pywin32-219.win-amd64-py3.5.exe)但是当 运行 python 解释器时并尝试 "import win32api" 我收到以下错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.

如果我下载 zip 文件并尝试 运行 "setup3.py install" 我得到以下输出:

Converting...
Executing...
Building pywin32 3.5.219.0
Traceback (most recent call last):
  File "setup3.py", line 16, in <module>
    exec(str(got))
  File "<string>", line 1929, in <module>
  File "<string>", line 587, in __init__
  File "C:\Python35\lib\ntpath.py", line 113, in join
    genericpath._check_arg_types('join', path, *paths)
  File "C:\Python35\lib\genericpath.py", line 143, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'

我尝试了一些方法,但无法正常工作。

有没有人安装 pywin32 并与 python 3.5 一起正常工作?

您需要 运行 pywin 安装程序在写入 system32 文件夹时具有提升的权限。如果您没有 运行 提升权限,请打开管理员 cmd 提示符并 运行 pywin 安装目录中的安装后脚本。

从源代码编译错误与 pywin32 没有捕捉到最终导致一切崩溃的错误有关。特别是 setup.py 的第 587 行会在 sdk_dir 为 None 时导致崩溃。

将第 587 行更改为

if sdk_dir and os.path.isfile(os.path.join(sdk_dir, "include", "activdbg.h")):

防止崩溃,但我的安装后来崩溃并出现以下错误:

win32/src/win32wnet/PyNetresource.cpp(120): error C2440: 'initializing': 
cannot convert from 'int (__cdecl *)(PyObject *,PyObject *)' to 'PyAsyncMethods *'win32/src/win32wnet/PyNetresource.cpp(120): note: There is no context in which this conversion is possible
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe' failed with exit status 2