安装 getch 模块时出错 Python 3.5
Error installing getch module Python 3.5
我在尝试 pip 安装 getch 模块时遇到问题。
当我使用命令 pip install getch
时,我得到以下结果
C:\Users\jpyam_000>pip install getch
Collecting getch
Using cached getch-1.0.tar.gz
Building wheels for collected packages: getch
Running setup.py bdist_wheel for getch ... error
Complete output from command c:\users\jpyam_000\appdata\local\programs\python\python35-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\JPYAM_~1\AppData\Local\Temp\pip-build-gpiafze6\getch\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d C:\Users\JPYAM_~1\AppData\Local\Temp\tmpryw1aohjpip-wheel- --python-tag cp35:
running bdist_wheel
running build
running build_ext
building 'getch' extension
creating build
creating build\temp.win32-3.5
creating build\temp.win32-3.5\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -I/usr/include -Ic:\users\jpyam_000\appdata\local\programs\python\python35-32\include -Ic:\users\jpyam_000\appdata\local\programs\python\python35-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\include.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits.1\include\shared" "-IC:\Program Files (x86)\Windows Kits.1\include\um" "-IC:\Program Files (x86)\Windows Kits.1\include\winrt" /Tcgetchmodule.c /Fobuild\temp.win32-3.5\Release\getchmodule.obj
getchmodule.c
getchmodule.c(2): fatal error C1083: Cannot open include file: 'termios.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe' failed with exit status 2
----------------------------------------
Failed building wheel for getch
Running setup.py clean for getch
Failed to build getch
Installing collected packages: getch
Running setup.py install for getch ... error
Complete output from command c:\users\jpyam_000\appdata\local\programs\python\python35-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\JPYAM_~1\AppData\Local\Temp\pip-build-gpiafze6\getch\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\JPYAM_~1\AppData\Local\Temp\pip-1ybqkxk4-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'getch' extension
creating build
creating build\temp.win32-3.5
creating build\temp.win32-3.5\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -I/usr/include -Ic:\users\jpyam_000\appdata\local\programs\python\python35-32\include -Ic:\users\jpyam_000\appdata\local\programs\python\python35-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\include.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits.1\include\shared" "-IC:\Program Files (x86)\Windows Kits.1\include\um" "-IC:\Program Files (x86)\Windows Kits.1\include\winrt" /Tcgetchmodule.c /Fobuild\temp.win32-3.5\Release\getchmodule.obj
getchmodule.c
getchmodule.c(2): fatal error C1083: Cannot open include file: 'termios.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\users\jpyam_000\appdata\local\programs\python\python35-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\JPYAM_~1\AppData\Local\Temp\pip-build-gpiafze6\getch\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\JPYAM_~1\AppData\Local\Temp\pip-1ybqkxk4-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\JPYAM_~1\AppData\Local\Temp\pip-build-gpiafze6\getch\
C:\Users\jpyam_000>
拜托,我需要一些帮助。谢谢。
getch
模块与 Windows 不兼容。
阅读 the module's pypi page 上的说明以了解 Windows 兼容的替代方案:
Hint: On Windows, you can use:
import msvcrt
# ...
char = msvcrt.getch()
# or, to display it on the screen
char = msvcrt.getche()
as a standard library alternative to this module
我在尝试 pip 安装 getch 模块时遇到问题。
当我使用命令 pip install getch
时,我得到以下结果
C:\Users\jpyam_000>pip install getch
Collecting getch
Using cached getch-1.0.tar.gz
Building wheels for collected packages: getch
Running setup.py bdist_wheel for getch ... error
Complete output from command c:\users\jpyam_000\appdata\local\programs\python\python35-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\JPYAM_~1\AppData\Local\Temp\pip-build-gpiafze6\getch\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d C:\Users\JPYAM_~1\AppData\Local\Temp\tmpryw1aohjpip-wheel- --python-tag cp35:
running bdist_wheel
running build
running build_ext
building 'getch' extension
creating build
creating build\temp.win32-3.5
creating build\temp.win32-3.5\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -I/usr/include -Ic:\users\jpyam_000\appdata\local\programs\python\python35-32\include -Ic:\users\jpyam_000\appdata\local\programs\python\python35-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\include.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits.1\include\shared" "-IC:\Program Files (x86)\Windows Kits.1\include\um" "-IC:\Program Files (x86)\Windows Kits.1\include\winrt" /Tcgetchmodule.c /Fobuild\temp.win32-3.5\Release\getchmodule.obj
getchmodule.c
getchmodule.c(2): fatal error C1083: Cannot open include file: 'termios.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe' failed with exit status 2
----------------------------------------
Failed building wheel for getch
Running setup.py clean for getch
Failed to build getch
Installing collected packages: getch
Running setup.py install for getch ... error
Complete output from command c:\users\jpyam_000\appdata\local\programs\python\python35-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\JPYAM_~1\AppData\Local\Temp\pip-build-gpiafze6\getch\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\JPYAM_~1\AppData\Local\Temp\pip-1ybqkxk4-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'getch' extension
creating build
creating build\temp.win32-3.5
creating build\temp.win32-3.5\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -I/usr/include -Ic:\users\jpyam_000\appdata\local\programs\python\python35-32\include -Ic:\users\jpyam_000\appdata\local\programs\python\python35-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\include.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits.1\include\shared" "-IC:\Program Files (x86)\Windows Kits.1\include\um" "-IC:\Program Files (x86)\Windows Kits.1\include\winrt" /Tcgetchmodule.c /Fobuild\temp.win32-3.5\Release\getchmodule.obj
getchmodule.c
getchmodule.c(2): fatal error C1083: Cannot open include file: 'termios.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\users\jpyam_000\appdata\local\programs\python\python35-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\JPYAM_~1\AppData\Local\Temp\pip-build-gpiafze6\getch\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\JPYAM_~1\AppData\Local\Temp\pip-1ybqkxk4-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\JPYAM_~1\AppData\Local\Temp\pip-build-gpiafze6\getch\
C:\Users\jpyam_000>
拜托,我需要一些帮助。谢谢。
getch
模块与 Windows 不兼容。
阅读 the module's pypi page 上的说明以了解 Windows 兼容的替代方案:
Hint: On Windows, you can use:
import msvcrt # ... char = msvcrt.getch() # or, to display it on the screen char = msvcrt.getche()
as a standard library alternative to this module