哈工大自然语言处理ltp在windows10下的源代码安装时builtin_converters.cpp报错

本文涉及的产品
NLP自然语言处理_基础版,每接口每天50万次
NLP自然语言处理_高级版,每接口累计50万次
NLP 自学习平台,3个模型定制额度 1个月
简介: 安装LTP的环境要求比较复杂,首先cmake,VS2010等等。今天要说的时编译过程中出现的一个坑,python setup.py install,编译到后面会报错。直接上错误代码: patch\libs\python\src\converter\builtin_converters.

安装LTP的环境要求比较复杂,首先cmake,VS2010等等。今天要说的时编译过程中出现的一个坑,python setup.py install,编译到后面会报错。直接上错误代码:


patch\libs\python\src\converter\builtin_converters.cpp(51): error C2440: “return”: 无法从“const char *”转换为“void *”
patch\libs\python\src\converter\builtin_converters.cpp(51): note: 转换丢失限定符
patch\libs\python\src\converter\builtin_converters.cpp(443): warning C4244: “初始化”: 从“Py_ssize_t”转换到“int”,可能丢失数据
error: command 'D:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

错误说的很清楚,就是类型转换出错。51行加 (void*),使用强制转换暴力解决即可:

  // Python String.
#if PY_VERSION_HEX < 0x03000000
  void* convert_to_cstring(PyObject* obj)
  {
      return PyString_Check(obj) ? PyString_AsString(obj) : 0;
  }
#else
  void* convert_to_cstring(PyObject* obj)
  {
      return PyUnicode_Check(obj) ?  (void*) _PyUnicode_AsString(obj) : 0;       
  }
#endif

语义角色标准过程中如果出现以下错误:

labeller.load(srl_model_path)  # 加载模型
RuntimeError: incompatible native format - size of long

那多半是你的模型库没有加载正确,win10下面的模型库需要的是pisrl_win.model。文档http://ltp.ai/download.html里面写的很明确。

当前版本:3.4.0
在你的平台上下载 LTP 源码或预编译安装包,然后即可马上进行开发。

注:3.4.0 版本 SRL模型 pisrl.model 如在windows系统下不可用,可以到 此链接 下载支持windows的语义角色标注模型。

目录
相关文章
|
9天前
|
Windows
Windows操作系统部署安装Kerberos客户端
详细介绍了在Windows操作系统上部署安装Kerberos客户端的完整过程,包括下载安装包、安装步骤、自定义安装路径、修改环境变量、配置hosts文件和Kerberos配置文件,以及安装后的验证步骤。
23 3
Windows操作系统部署安装Kerberos客户端
|
19天前
|
缓存 NoSQL Linux
【Azure Redis 缓存】Windows和Linux系统本地安装Redis, 加载dump.rdb中数据以及通过AOF日志文件追加数据
【Azure Redis 缓存】Windows和Linux系统本地安装Redis, 加载dump.rdb中数据以及通过AOF日志文件追加数据
【Azure Redis 缓存】Windows和Linux系统本地安装Redis, 加载dump.rdb中数据以及通过AOF日志文件追加数据
|
8天前
|
网络安全 虚拟化 Windows
windows 11安装openSSH server 遇到的"kex_exchange_identification: read: Connection reset"问题
windows 11安装openSSH server 遇到的"kex_exchange_identification: read: Connection reset"问题
|
15天前
|
Ubuntu Linux 虚拟化
安装Windows Linux 子系统的方法:适用于windows 11 版本
本文提供了在Windows 11系统上安装Linux子系统(WSL)的详细步骤,包括启用子系统和虚拟化功能、从Microsoft Store安装Linux发行版、设置WSL默认版本、安装WSL2补丁,以及完成Ubuntu的首次安装设置。
51 2
|
14天前
|
API Docker Windows
2024 Ollama 一站式解决在Windows系统安装、使用、定制服务与实战案例
这篇文章是一份关于Ollama工具的一站式使用指南,涵盖了在Windows系统上安装、使用和定制服务,以及实战案例。
2024 Ollama 一站式解决在Windows系统安装、使用、定制服务与实战案例
|
14天前
|
网络安全 Windows
windows安装ssh服务
windows安装ssh服务
17 0
|
18天前
|
Shell PHP Windows
【Azure App Service】Web Job 报错 UNC paths are not supported. Defaulting to Windows directory.
【Azure App Service】Web Job 报错 UNC paths are not supported. Defaulting to Windows directory.
|
18天前
|
Java 开发工具 Spring
【Azure Spring Cloud】使用azure-spring-boot-starter-storage来上传文件报错: java.net.UnknownHostException: xxxxxxxx.blob.core.windows.net: Name or service not known
【Azure Spring Cloud】使用azure-spring-boot-starter-storage来上传文件报错: java.net.UnknownHostException: xxxxxxxx.blob.core.windows.net: Name or service not known
|
18天前
【Azure 应用服务】App Service 配置 Application Settings 访问Storage Account得到 could not be resolved: '*.file.core.windows.net'的报错。没有解析成对应中国区 Storage Account地址 *.file.core.chinacloudapi.cn
【Azure 应用服务】App Service 配置 Application Settings 访问Storage Account得到 could not be resolved: '*.file.core.windows.net'的报错。没有解析成对应中国区 Storage Account地址 *.file.core.chinacloudapi.cn
|
20天前
|
Linux Python Windows
【Azure 环境】Windows中安装Python azure-eventhub-checkpointstoreblob-aio模块时出错 ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory:
【Azure 环境】Windows中安装Python azure-eventhub-checkpointstoreblob-aio模块时出错 ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory:

热门文章

最新文章