无法使pywin32-219与Python 3.5配合使用

6

使用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'

我已经尝试了几种方法,但无法使其正常工作。

有人已经成功地安装并在Python 3.5中正确运行pywin32吗?

2个回答

2

您需要以管理员权限运行pywin安装程序,因为它会写入system32文件夹。如果没有以管理员权限运行,请打开管理员命令提示符并在pywin安装目录中运行postinstall脚本。


1
编译源代码时出现的错误与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 

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接