python mmseg WindowsError: [Error 126]

#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Function:
【记录】折腾Python中的mmseg中文分词模块

http://www.crifan.com/try_python_mmseg_chinese_segment_on_mmseg_algorithm

Author: Crifan Li
Version: 2013-01-02
Contact: admin at crifan dot com
"""

from mmseg import seg_txt;

def tryMmseg():
for i in seg_txt("最主要的更动是:张无忌最后没有选定自己的配偶。"):
print i;

if __name__ == "__main__":
tryMmseg();
结果出错了:

E:\Dev_Root\python\try_mmseg>try_mmseg.py
Traceback (most recent call last):
File "E:\Dev_Root\python\try_mmseg\try_mmseg.py", line 13, in <module>
from mmseg import seg_txt;
File "E:\dev_install_root\Python27\lib\site-packages\mmseg-1.3.0-py2.7-win-amd64.egg\mmseg\__init__.py", line 3, in <m
odule>
import _mmseg as mmseg
File "E:\dev_install_root\Python27\lib\site-packages\mmseg-1.3.0-py2.7-win-amd64.egg\mmseg\_mmseg.py", line 28, in <mo
dule>
mmseg = cdll.LoadLibrary(mmseg_lib_path)
File "E:\dev_install_root\Python27\lib\ctypes\__init__.py", line 431, in LoadLibrary
return self._dlltype(name)
File "E:\dev_install_root\Python27\lib\ctypes\__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126]


【解决过程】

1.以为是代码中导入有问题呢。

所以参考:

mmseg 1.3.0

去执行search结果也是同样错误:

E:\Dev_Root\python\try_mmseg>python -m mmseg.search
Traceback (most recent call last):
File "E:\dev_install_root\Python27\lib\runpy.py", line 151, in _run_module_as_main
mod_name, loader, code, fname = _get_module_details(mod_name)
File "E:\dev_install_root\Python27\lib\runpy.py", line 101, in _get_module_details
loader = get_loader(mod_name)
File "E:\dev_install_root\Python27\lib\pkgutil.py", line 456, in get_loader
return find_loader(fullname)
File "E:\dev_install_root\Python27\lib\pkgutil.py", line 466, in find_loader
for importer in iter_importers(fullname):
File "E:\dev_install_root\Python27\lib\pkgutil.py", line 422, in iter_importers
__import__(pkg)
File "E:\dev_install_root\Python27\lib\site-packages\mmseg-1.3.0-py2.7-win-amd64.egg\mmseg\__init__.py", line 3, in <m
odule>
import _mmseg as mmseg
File "E:\dev_install_root\Python27\lib\site-packages\mmseg-1.3.0-py2.7-win-amd64.egg\mmseg\_mmseg.py", line 28, in <mo
dule>
mmseg = cdll.LoadLibrary(mmseg_lib_path)
File "E:\dev_install_root\Python27\lib\ctypes\__init__.py", line 431, in LoadLibrary
return self._dlltype(name)
File "E:\dev_install_root\Python27\lib\ctypes\__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126]
2.去查了下,知道了错误的意思,就是没有找到对应的dll库,说白了,就是之前没有正常的完整编译mmseg,所以后来误以为正确安装,此处运行代码出错。

3.关于此,专门去删除了旧的mmseg-1.3.0,重新解压了一份mmseg-1.3.0,然后再去setup.py install结果的确是无法正常编译。所以验证了此处的猜测:

没有正常编译和安装mmseg,导致此处的WindowsError: [Error 126]的错误。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在你提供的引用中,ERROR: Could not find a version that satisfies the requirement mmseg和ERROR: No matching distribution found for mmseg是由于没有找到满足mmseg要求的版本而导致的错误。 根据引用中的描述,可能是因为你使用的是64位的电脑,而官网提供的安装包只有32位的,所以无法找到匹配的分发版本。 另外,引用中提到,这个问题可能与pip的版本有关。如果你在安装其他库的过程中遇到问题,可以尝试将pip的版本降低到20.2.3,可以通过运行以下命令来降低pip的版本: python -m pip install pip==20.2.3 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 这样做可能会解决mmseg找不到版本的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Could not find a version that satisfies the requirement mmseg No matching distribution found for mms](https://blog.csdn.net/weixin_44025103/article/details/129861243)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [Could not find a version that satisfies the requirement PIL (from versions: ) No matching distribu](https://download.csdn.net/download/weixin_38722721/13750519)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [新版pip在安装一些库的时候的问题](https://blog.csdn.net/AWhiteDongDong/article/details/111227469)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值