在 python 3.7.4 上安装 sendkeys 包

在 python 3.7.4 上安装 sendkeys 包

我使用的是 win10、python 3.7.4,并且尝试了谷歌上的每一个解决方案,我非常沮丧。

当使用“pip install sendkeys”安装时,我首先收到一条错误,说我需要 VS14.0,因此我安装了它并收到以下错误(完整输出):

setuptools, tokenize;__file__='C:\\Users\\USER~1\\AppData\\Local\\Temp\\pip-install-t7sd2cl6\\sendkeys\\setup.py';f=ge
tattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec
'))" install --record C:\Users\USER~1\AppData\Local\Temp\pip-record-_sa0wnhf\install-record.txt --single-version-exter
nally-managed --compile --install-headers "C:\Users\username\PycharmProjects\WAscript\venv\include\site\python3.7\se
ndkeys":
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.7
    copying SendKeys.py -> build\lib.win32-3.7
    running build_ext
    building '_sendkeys' extension
    creating build\temp.win32-3.7
    creating build\temp.win32-3.7\Release
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Users\username\PycharmProjects\WAscript\venv\include" "-IC:\Users\Yusername\AppData\Local\Programs\Python\Python37-32\inc
lude" "-IC:\Users\username\AppData\Local\Programs\Python\Python37-32\include" "-IC:\Program Files (x86)\Microsoft Vi
sual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x
86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Wi
ndows Kits\8.1\include\winrt" /Tc_sendkeys.c /Fobuild\temp.win32-3.7\Release\_sendkeys.obj
    _sendkeys.c
    _sendkeys.c(150): warning C4013: 'Py_InitModule' undefined; assuming extern returning int
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMB
ED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Users\username\PycharmProjects\WAscript\venv\libs" "/LIBPATH:C:\Users\username\AppData\Local\Programs\Python\Python37-32\libs" "/LIBPATH:C:\Users\username\AppData\Local\Programs\Python\Python
37-32" "/LIBPATH:C:\Users\username\PycharmProjects\WAscript\venv\PCbuild\win32" "/LIBPATH:C:\Program Files (x86)\Mic
rosoft Visual Studio 14.0\VC\LIB" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x86" "/LIBPATH:
C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86" user32.lib kernel32.lib /EXPORT:PyInit__sendkeys build\temp.
win32-3.7\Release\_sendkeys.obj /OUT:build\lib.win32-3.7\_sendkeys.cp37-win32.pyd /IMPLIB:build\temp.win32-3.7\Release\_
sendkeys.cp37-win32.lib
    LINK : error LNK2001: unresolved external symbol PyInit__sendkeys
    build\temp.win32-3.7\Release\_sendkeys.cp37-win32.lib : fatal error LNK1120: 1 unresolved externals
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\link.exe' failed with exit status 11
20

    ----------------------------------------
Command ""C:\Users\username\PycharmProjects\WAscript\venv\Scripts\python.exe" -u -c "import setuptools, tokenize;__f
ile__='C:\\Users\\USER~1\\AppData\\Local\\Temp\\pip-install-t7sd2cl6\\sendkeys\\setup.py';f=getattr(tokenize, 'open',
open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:
\Users\USER~1\AppData\Local\Temp\pip-record-_sa0wnhf\install-record.txt --single-version-externally-managed --compile
--install-headers "C:\Users\username\PycharmProjects\WAscript\venv\include\site\python3.7\sendkeys"" failed with err
or code 1 in C:\Users\USER~1\AppData\Local\Temp\pip-install-t7sd2cl6\sendkeys\

我尝试使用各种 VS cmd、win10 cmd、更新所有包、将内容添加到 PATH、重新安装和修复应用程序、在几个文件夹中复制粘贴 rc.exe 和 rcdll.dll 文件等等。我错过了什么?

相关内容