本文介绍了在Mac OS 10.14.2的Python 3.7中安装JPype1时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在系统中安装JPype1时出现错误.我正在使用Python 3.7.JPype1是Jaydebeapi的依赖项.

I am getting error while installing JPype1 in my system. I am using Python 3.7. JPype1 is required as dependency for Jaydebeapi.

pip install Jpype1

以下是错误消息:



    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/

推荐答案

首先使用conda安装gcc

First install gcc using conda

conda install gcc

然后对jpype1使用二进制安装.从conda-forge软件渠道进行安装.

Then use binary installation for jpype1. Install it from the conda-forge software channel.

conda install -c conda-forge jpype1

对我有用.

它也适用于Python2.7

It also works for Python2.7

这篇关于在Mac OS 10.14.2的Python 3.7中安装JPype1时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-14 11:45