无法使pywin32-219与python 3.5一起使用

时间:2015-10-03 08:59:44

标签: python pywin32

使用EXE(在我的情况下是pywin32-219.win-amd64-py3.5.exe)似乎没有错误安装但是当运行python解释器并尝试“导入win32api”时,我收到以下错误:< / p>

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'

我尝试了几件事,但无法让它发挥作用。

有没有人使用python32安装并正常使用python 3.5?

2 个答案:

答案 0 :(得分:2)

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

答案 1 :(得分:1)

从源错误编译与pywin32有关,没有捕获到最终导致崩溃的错误。如果sdk_dir为None,则setup.py的第587行会导致崩溃。

将第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