PythonでSendKeys (Winsows10)

Pythonから電卓を起動し勝手に計算してもらうの以下を動かそうとして
import SendKeys

SendKeys.SendKeys("""
    {LWIN}
    {PAUSE .25}
    calc.exe{ENTER}
    {PAUSE 1}
    10
    {+}
    5
    {=}
    {PAUSE 1}
""")

以下を行ったと所成大にエラーになった。
pip install SendKeys

C:\PROJECT\python>pip install SendKeys
Collecting SendKeys
  Using cached SendKeys-0.3.zip (8.4 kB)
Installing collected packages: SendKeys
    Running setup.py install for SendKeys ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\xx\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xx\\AppData\\Local\\Temp\\pip-install-q0n1ia0d\\SendKeys\\setup.py'"'"'; __file__='"'"'C:\\Users\\xx\\AppData\\Local\\Temp\\pip-install-q0n1ia0d\\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\xx\AppData\Local\Temp\pip-record-arcc4euz\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\xx\appdata\local\programs\python\python37\Include\SendKeys'
         cwd: C:\Users\xx\AppData\Local\Temp\pip-install-q0n1ia0d\SendKeys\
    Complete output (9 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    copying SendKeys.py -> build\lib.win-amd64-3.7
    running build_ext
    building '_sendkeys' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\xx\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xx\\AppData\\Local\\Temp\\pip-install-q0n1ia0d\\SendKeys\\setup.py'"'"'; __file__='"'"'C:\\Users\\xx\\AppData\\Local\\Temp\\pip-install-q0n1ia0d\\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\xx\AppData\Local\Temp\pip-record-arcc4euz\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\xx\appdata\local\programs\python\python37\Include\SendKeys' Check the logs for full command output.


    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": 

上記エラー内容から見てビルド系のようなので
Pythonのpipインストールエラーでハマった話[Windows]から
https://visualstudio.microsoft.com/ja/downloads/から「Build Tools for Visual Studio 2019」をDLした。(2017はもうなかった)
しばらくしてウィンドウが表示されたら一番上の「Visual C++ Build Tools」にチェックを入れて右側の「概要」より、オプション一番上の「Windows 10 SDK(xx.x.xxxx)」に最低限チェックが入っていることを確認して、インストール。

コメント

このブログの人気の投稿

Python OpenCVとWebカメラでバーコードリーダー

OpenCV 画像の足し算

OpenCV3とPython3で形状のある物体の輪郭と方向を認識する(主成分分析:PCA、固有ベクトル)