安装pyahocorasick库出现的错误及解决方案

安装pyahocorasick库出现的错误及解决方案

下载:https://pypi.org/project/pyahocorasick/
基本使用官网:https://pyahocorasick.readthedocs.io/en/latest/

  • 出现错误:ModuleNotFoundError: No module named ‘setuptools.wheel’,如下:
F:\anaconda3\Lib\site-packages\pyahocorasick-1.3.0>python setup.py install
F:\anaconda3\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
running install
Traceback (most recent call last):
  File "setup.py", line 121, in <module>
    'Topic :: Text Editors :: Text Processing',
  File "F:\anaconda3\lib\site-packages\setuptools\__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "F:\anaconda3\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "F:\anaconda3\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "F:\anaconda3\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "F:\anaconda3\lib\site-packages\setuptools\command\install.py", line 67, in run
    self.do_egg_install()
  File "F:\anaconda3\lib\site-packages\setuptools\command\install.py", line 98, in do_egg_install
    easy_install = self.distribution.get_command_class('easy_install')
  File "F:\anaconda3\lib\site-packages\setuptools\dist.py", line 625, in get_command_class
    self.cmdclass[command] = cmdclass = ep.load()
  File "F:\anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2322, in load
    return self.resolve()
  File "F:\anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2328, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "F:\anaconda3\lib\site-packages\setuptools\command\easy_install.py", line 52, in <module>
    from setuptools.package_index import (
  File "F:\anaconda3\lib\site-packages\setuptools\package_index.py", line 27, in <module>
    from setuptools.wheel import Wheel
ModuleNotFoundError: No module named 'setuptools.wheel'
F:\anaconda3\Lib\site-packages\pyahocorasick-1.3.0>python setup.py install
running install
running bdist_egg
running egg_info
writing pyahocorasick.egg-info\PKG-INFO
writing dependency_links to pyahocorasick.egg-info\dependency_links.txt
writing top-level names to pyahocorasick.egg-info\top_level.txt
reading manifest file 'pyahocorasick.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'travis.yml'
writing manifest file 'pyahocorasick.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_ext
building 'ahocorasick' extension
creating build
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
F:\MinGW\mingw64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -DAHOCORASICK_UNICODE= -IF:\anaconda3\include -IF:\anaconda3\include -c pyahocorasick.c -o build\temp.win-amd64-3.6\Release\pyahocorasick.o
In file included from F:\anaconda3\include/pytime.h:6,
                 from F:\anaconda3\include/Python.h:65,
                 from common.h:14,
                 from pyahocorasick.c:13:
posix.h:14:51: error: initializer element is not constant
 #define PY_OBJECT_HEAD_INIT PyVarObject_HEAD_INIT(&PyType_Type, 0)
                                                   ^
F:\anaconda3\include/object.h:87:8: note: in definition of macro 'PyObject_HEAD_INIT'
     1, type },
        ^~~~
posix.h:14:29: note: in expansion of macro 'PyVarObject_HEAD_INIT'
 #define PY_OBJECT_HEAD_INIT PyVarObject_HEAD_INIT(&PyType_Type, 0)
                             ^~~~~~~~~~~~~~~~~~~~~
Automaton.c:1331:2: note: in expansion of macro 'PY_OBJECT_HEAD_INIT'
  PY_OBJECT_HEAD_INIT
  ^~~~~~~~~~~~~~~~~~~
posix.h:14:51: note: (near initialization for 'automaton_type.ob_base.ob_base.ob_type')
 #define PY_OBJECT_HEAD_INIT PyVarObject_HEAD_INIT(&PyType_Type, 0)
                                                   ^
F:\anaconda3\include/object.h:87:8: note: in definition of macro 'PyObject_HEAD_INIT'
     1, type },
        ^~~~
posix.h:14:29: note: in expansion of macro 'PyVarObject_HEAD_INIT'
 #define PY_OBJECT_HEAD_INIT PyVarObject_HEAD_INIT(&PyType_Type, 0)
                             ^~~~~~~~~~~~~~~~~~~~~
Automaton.c:1331:2: note: in expansion of macro 'PY_OBJECT_HEAD_INIT'
  PY_OBJECT_HEAD_INIT
  ^~~~~~~~~~~~~~~~~~~
posix.h:14:51: error: initializer element is not constant
 #define PY_OBJECT_HEAD_INIT PyVarObject_HEAD_INIT(&PyType_Type, 0)
                                                   ^
F:\anaconda3\include/object.h:87:8: note: in definition of macro 'PyObject_HEAD_INIT'
     1, type },
        ^~~~
posix.h:14:29: note: in expansion of macro 'PyVarObject_HEAD_INIT'
 #define PY_OBJECT_HEAD_INIT PyVarObject_HEAD_INIT(&PyType_Type, 0)
                             ^~~~~~~~~~~~~~~~~~~~~
AutomatonItemsIter.c:286:2: note: in expansion of macro 'PY_OBJECT_HEAD_INIT'
  PY_OBJECT_HEAD_INIT
  ^~~~~~~~~~~~~~~~~~~
posix.h:14:51: note: (near initialization for 'automaton_items_iter_type.ob_base.ob_base.ob_type')
 #define PY_OBJECT_HEAD_INIT PyVarObject_HEAD_INIT(&PyType_Type, 0)
                                                   ^
F:\anaconda3\include/object.h:87:8: note: in definition of macro 'PyObject_HEAD_INIT'
     1, type },
        ^~~~
posix.h:14:29: note: in expansion of macro 'PyVarObject_HEAD_INIT'
 #define PY_OBJECT_HEAD_INIT PyVarObject_HEAD_INIT(&PyType_Type, 0)
                             ^~~~~~~~~~~~~~~~~~~~~
AutomatonItemsIter.c:286:2: note: in expansion of macro 'PY_OBJECT_HEAD_INIT'
  PY_OBJECT_HEAD_INIT
  ^~~~~~~~~~~~~~~~~~~
posix.h:14:51: error: initializer element is not constant
 #define PY_OBJECT_HEAD_INIT PyVarObject_HEAD_INIT(&PyType_Type, 0)
                                                   ^
F:\anaconda3\include/object.h:87:8: note: in definition of macro 'PyObject_HEAD_INIT'
     1, type },
        ^~~~
posix.h:14:29: note: in expansion of macro 'PyVarObject_HEAD_INIT'
 #define PY_OBJECT_HEAD_INIT PyVarObject_HEAD_INIT(&PyType_Type, 0)
                             ^~~~~~~~~~~~~~~~~~~~~
AutomatonSearchIter.c:396:2: note: in expansion of macro 'PY_OBJECT_HEAD_INIT'
  PY_OBJECT_HEAD_INIT
  ^~~~~~~~~~~~~~~~~~~
posix.h:14:51: note: (near initialization for 'automaton_search_iter_type.ob_base.ob_base.ob_type')
 #define PY_OBJECT_HEAD_INIT PyVarObject_HEAD_INIT(&PyType_Type, 0)
                                                   ^
F:\anaconda3\include/object.h:87:8: note: in definition of macro 'PyObject_HEAD_INIT'
     1, type },
        ^~~~
posix.h:14:29: note: in expansion of macro 'PyVarObject_HEAD_INIT'
 #define PY_OBJECT_HEAD_INIT PyVarObject_HEAD_INIT(&PyType_Type, 0)
                             ^~~~~~~~~~~~~~~~~~~~~
AutomatonSearchIter.c:396:2: note: in expansion of macro 'PY_OBJECT_HEAD_INIT'
  PY_OBJECT_HEAD_INIT
  ^~~~~~~~~~~~~~~~~~~
In file included from allsources.c:5,
                 from pyahocorasick.c:33:
src/custompickle/load/loadbuffer.c: In function 'loadbuffer_init':
src/custompickle/load/loadbuffer.c:68:30: warning: overflow in conversion from 'long long unsigned int' to 'long int' changes value from '18446744073709551592' to '-24' [-Woverflow]
     ret = fseek(input->file, -sizeof(CustompickleFooter), SEEK_END);
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
error: command 'F:\\MinGW\\mingw64\\bin\\gcc.exe' failed with exit status 1

F:\anaconda3\Lib\site-packages\pyahocorasick-1.3.0>python setup.py install
running install
running bdist_egg
running egg_info
writing pyahocorasick.egg-info\PKG-INFO
writing dependency_links to pyahocorasick.egg-info\dependency_links.txt
writing top-level names to pyahocorasick.egg-info\top_level.txt
reading manifest file 'pyahocorasick.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'travis.yml'
writing manifest file 'pyahocorasick.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_ext
building 'ahocorasick' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

只有老老实实下载Microsoft Visual C++ 14.0,进行安装了,下载:
https://blog.csdn.net/qq_20159855/article/details/79685003
在这里插入图片描述

  • pyahocorasick 安装成功
    在这里插入图片描述
    一波三折,记录下。。。。。。。。。。

猜你喜欢

转载自blog.csdn.net/weixin_41104835/article/details/89024861
今日推荐