当前位置: 首页 > 工具软件 > HarvestText > 使用案例 >

安装harvesttext心得

宓文斌
2023-12-01

安装harvesttext心得

之前采用的是python3.9安装harvesttext,导致过程中一直会出现jpype1构建失败。

Building wheels for collected packages: jpype1
  Building wheel for jpype1 (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/python@3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/62/5qr78jhx101f56fs4q51bm800000gn/T/pip-install-_xvxxeuv/jpype1_e1385f40ba314b73ad202f43b4fe1c55/setup.py'"'"'; __file__='"'"'/private/var/folders/62/5qr78jhx101f56fs4q51bm800000gn/T/pip-install-_xvxxeuv/jpype1_e1385f40ba314b73ad202f43b4fe1c55/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/62/5qr78jhx101f56fs4q51bm800000gn/T/pip-wheel-shdkuqaj
       cwd: /private/var/folders/62/5qr78jhx101f56fs4q51bm800000gn/T/pip-install-_xvxxeuv/jpype1_e1385f40ba314b73ad202f43b4fe1c55/
  Complete output (92 lines):
  /usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'use_scm_version'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.15-x86_64-3.9
  creating build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jcollection.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jcomparable.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_classpath.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jio.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jtypes.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_pykeywords.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jproxy.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_gui.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_darwin.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/nio.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jstring.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_cygwin.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/__init__.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jboxed.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/types.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/beans.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jvmfinder.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/imports.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jcustomizer.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_core.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jinit.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_linux.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jarray.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jobject.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jclass.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_windows.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jexception.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/reflect.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  copying jpype/_jpackage.py -> build/lib.macosx-10.15-x86_64-3.9/jpype
  running build_ext
  running build_java
  Using Jar cache
  creating build/lib
  creating build/lib/org
  creating build/lib/org/jpype
  creating build/lib/org/jpype/classloader
  copying native/jars/org/jpype/classloader/JPypeClassLoader.class -> build/lib/org/jpype/classloader
  copying native/jars/org.jpype.jar -> build/lib
  running build_thunk
  Building thunks
    including thunk build/lib/org/jpype/classloader/JPypeClassLoader.class
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/62/5qr78jhx101f56fs4q51bm800000gn/T/pip-install-_xvxxeuv/jpype1_e1385f40ba314b73ad202f43b4fe1c55/setup.py", line 10, in <module>
      setup(
    File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 79, in run
      _build_ext.run(self)
    File "/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build_ext.py", line 340, in run
      self.build_extensions()
    File "/private/var/folders/62/5qr78jhx101f56fs4q51bm800000gn/T/pip-install-_xvxxeuv/jpype1_e1385f40ba314b73ad202f43b4fe1c55/setupext/build_ext.py", line 72, in build_extensions
      self.run_command("build_thunk")
    File "/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/private/var/folders/62/5qr78jhx101f56fs4q51bm800000gn/T/pip-install-_xvxxeuv/jpype1_e1385f40ba314b73ad202f43b4fe1c55/setupext/build_thunk.py", line 149, in run
      createThunks(
    File "/private/var/folders/62/5qr78jhx101f56fs4q51bm800000gn/T/pip-install-_xvxxeuv/jpype1_e1385f40ba314b73ad202f43b4fe1c55/setupext/build_thunk.py", line 103, in createThunks
      outputClass(filename, name, fimpl)
    File "/private/var/folders/62/5qr78jhx101f56fs4q51bm800000gn/T/pip-install-_xvxxeuv/jpype1_e1385f40ba314b73ad202f43b4fe1c55/setupext/build_thunk.py", line 53, in outputClass
      output(fout, l)
    File "/private/var/folders/62/5qr78jhx101f56fs4q51bm800000gn/T/pip-install-_xvxxeuv/jpype1_e1385f40ba314b73ad202f43b4fe1c55/setupext/build_thunk.py", line 36, in output
      buffer.fromstring(l)
  AttributeError: 'array.array' object has no attribute 'fromstring'
  ----------------------------------------
  ERROR: Failed building wheel for jpype1
  Running setup.py clean for jpype1
Failed to build jpype1

Google上也没有关于harvesttext在python3.9上安装的相关教程,之后利用anaconda创建了一个pyhton3.7的虚拟环境,成功安装了harvesttext。
猜测可能是在3.9环境下安装的是1.2.1版本。

Requirement already satisfied: jpype1 in /usr/local/lib/python3.9/site-packages (1.2.1)

而在3.7环境下安装的是0.7.0版本。

Collecting jpype1==0.7.0
  Using cached JPype1-0.7.0.tar.gz (470 kB)
 类似资料: