论文阅读 Lexicon information in neural sentiment analysis: a multi-task learning approach

阅读这篇论文的目的是了解这篇论文如何结合情感词典实现句子级别的情感预测,所以对论文中的「引言」、「文献综述」部分略读。

引言

研究问题:如何将外部知识(情感词典)结合到神经模型中,提高情感预测的性能

问题重要性:

  • 结合外部知识(如情感词典)可以进一步提高模型的性能。
  • 神经模型通常难以解释,而情感词典具有完全透明的优势,可以增强模型的可解释性。
  • 情感词典易于适应和更新,可以更好地应对不同领域和数据的变化。

研究思路:采用多任务学习(multi-task learning, MTL)的架构实现同时处理两个任务。具体来说是,通过辅助任务学习情感词典这一外部知识,同时使用 BiLstm 情感分类器预测句子的情感类别。

文章的创新点或贡献:

  • 多任务学习框架。在句子级别情感分类器中结合情感词典信息。
  • 新挪威语词典。提供了一个新的挪威语情感词典,并且展示如何设计一个其他语言的情感词典
  • 在英语和挪威语数据集上进行了实验,证明了模型的有效性和鲁棒性。

文献综述

从 4 个方面回顾相关工作:(i)情感词典,(ii)基于词典的情感分析方法,(iii)在神经模型中使用词典信息,(iv)NLP中的多任务学习。

(ii)基于词典的情感分析方法:根据形容词的情感分数之和->增加否定、加强、虚拟、减弱词对情感分数的分配+增加形容词、名、动、副词。基于专家手动构建的词典比使用少量种子词通过算法扩展词典更好;使用手动构建词典的模型面对各种领域的鲁棒性比机器学习模型更强。

模型的设计

模型框架图

模型框架图

框架描述

多任务模型共享下面两层。

辅助任务

情感词典预测(辅助任务)用来预测单词是正面还是负面,从而优化 embedding layer 对句中单词的嵌入。为预测句子情感而增加单词情感嵌入,是因为认为单词情感预测对于句子情感预测具有较高的预测性(从实验结果表 3 分析得出)。

辅助任务的输入为使用预训练获得的单词嵌入,输出为情感类别(积极/消极)。

主要任务

句子情感预测模型(主要任务):将经过情感词典优化的词嵌入,输入 BiLSTM(为序列中每个词语提供一个综合其前后文信息的表示)中,输出不同情感类别的概率分布。

初始词嵌入
  • 英语:使用来自GoogleNews的预训练300维词嵌入。
  • 挪威语:使用100维的skip-gram fastText词嵌入,这些嵌入是在NoWaC语料库上训练得到的(Bojanowski et al., 2016)。

实验设计

数据集

英文句子数据集:斯坦福情感树库 SST,从英文电影评论中提取的 11855 个句子。每个句子被打标签为:强烈负面、负面、中立、正面、强烈正面。

主要任务是句子级别的情感分类,辅助任务是单词级别的情感预测。

挪威文句子数据集:挪威评论语料库 NoReC 的 NoReCeval,来自不同领域的完整文本评论,包括了分布在 298 篇文档中的 7,961 个句子。标注:评价、事实暗示、非评价。

主要任务是句子级别的评价性分类,辅助任务是单词级别的情感预测。

情感词典

情感词典

  • 英文情感词典:Hu 和 Liu
  • 挪威文情感词典:基于 Hu 和 Liu 的,并作如下三种调整
    • translated:机器翻译+人工修正
    • full-forms:基于 translated+挪威语全形时词典 SCARRIE 扩展 translated 中单词的其他形式
    • lemmas:从 full-forms 中还原单词的基本形式。覆盖广而且精简

生成挪威文情感词典

对比算法

  • LEXICON: 使用情感词典的模型。利用情感词典为句子中的每个词赋予情感极性标签(+1 表示正向,-1 表示负向,0 表示中性),然后将这些标签作为特征输入到线性 SVM 中进行分类。
  • BOW: Bag-of-Words(词袋模型)。使用词袋模型(Bag-of-Words)将句子表示为单词的集合,忽略单词的顺序,然后将这些词频信息作为特征输入到线性 SVM 中进行分类。
  • BOW+LEXICON: 结合词袋模型和情感词典的模型。是在 Bow 模型的基础上增加了两个额外的特征。
  • LEX-EMB: 使用词嵌入(Word Embeddings)的情感词典模型。使用情感词典学习词的情感嵌入,然后拼接原始词嵌入,得到带有情感信息的词表示,输入到 BiLstm 中,进行句子级别的情感分类。相较于 MTL 中交替训练(句子分类和词级情感预测)的区别是:Lex-Emb 学习情感词典中词嵌入和输入 BiLstm 为两个阶段,静态融合词典信息。
  • STL: 单任务学习(Single Task Learning)模型。不进行辅助任务,将句子中每个词转为与训练的词嵌入向量,然后输入 BiLstm 中,训练情感极性。
  • MTL: 多任务学习(Multi-Task Learning)模型。如图 1 所示。

评估指标 - Macro F1

Macro-F1 计算方式:

  1. 计算第 iii 类的 Precision 和 Recall:
    Precision⁡i=TPiTPi+FPiRecall⁡i=TPiTPi+FNi. \begin{gathered} \operatorname{Precision}_i=\frac{\mathrm{TP}_i}{\mathrm{TP}_i+\mathrm{FP}_i} \\ \operatorname{Recall}_i=\frac{\mathrm{TP}_i}{\mathrm{TP}_i+\mathrm{FN}_i} . \end{gathered} Precisioni=TPi+FPiTPiRecalli=TPi+FNiTPi.

(1)对各类别的 Precision 和 Recall 求平均:

 Precision macro =∑i=1nPrecision⁡in Recall macro =∑i=1nRecall⁡in \begin{aligned} \text { Precision }_{\text {macro }} & =\frac{\sum_{i=1}^n \operatorname{Precision}_i}{n} \\ \text { Recall }_{\text {macro }} & =\frac{\sum_{i=1}^n \operatorname{Recall}_i}{n} \end{aligned}  Precision macro  Recall macro =ni=1nPrecisioni=ni=1nRecalli

(2)利用 F1 计算公式,即可得到Macro-F1。

F1macro =2⋅ Precision macro ⋅ Recall macro  Precision macro + Recall macro  F 1_{\text {macro }}=2 \cdot \frac{\text { Precision }_{\text {macro }} \cdot \text { Recall }_{\text {macro }}}{\text { Precision }_{\text {macro }}+\text { Recall }_{\text {macro }}} F1macro =2 Precision macro + Recall macro  Precision macro  Recall macro 

选择 MacroF1 而非精度(accuracy)的原因:accuracy 易受多数类别的高准确率影响。

假设有一个二分类问题,数据集中有 100100100 个样本,其中 909090 个样本属于多数类别(正类),101010 个样本属于少数类别(负类)。某个模型的预测结果如下:

  • 多数类别(正类):
    • 预测正确: 81 个( 90%90\%90%
    • 预测错误:9 个(10%)
  • 少数类别(负类):
    • 预测正确:0 个(0%)
    • 预测错误:10 个(100%)

准确率的计算公式是:

 Accuracy = 正确预测的样本数  总样本数 =81+0100=0.81 \text { Accuracy }=\frac{\text { 正确预测的样本数 }}{\text { 总样本数 }}=\frac{81 + 0}{ 100 } = 0.81  Accuracy = 总样本数  正确预测的样本数 =10081+0=0.81

模型训练

交替训练:在训练期间,一个 epoch 训练主要任务,下一个 epoch 训练辅助任务,交替训练的方式。(实验表明,每批之间的交替训练或从这两个任务中均匀抽样批次等复杂训练策略并没有改善指标效果)

训练细节

  • 优化器:使用 Adam 优化器(Kingma and Ba, 2014)进行训练。
  • 训练轮数:模型训练 10 个 epochs,并采用早期停止策略,根据主任务在开发集上的表现来决定是否提前终止训练。
  • 随机初始化敏感性:由于神经网络模型对参数的随机初始化非常敏感,因此进行了五次独立的运行,每次运行使用不同的随机种子。最终结果展示的是这五次运行的平均值和标准差。
  • 一致性:为了确保不同模型之间的公平比较,所有实验都使用相同的五个随机种子。

每个模型运行 5 次,每次运行使用不同的随机种子,最终结果求 5 次运行的平均值。对于 MTL 模型而言,每次运行,一共有 10 个 epoch,辅助任务和主要任务交替 epoch。

实验结果

主要任务对比

  1. Bow 在 SST 数据集上效果好,但在 NoReCeval 上的效果比 STL 相差较多
  2. Bow+LEXICON 在两个数据集上都完胜 Bow,表明从情感词典学习到的特征有助于预测
  3. LEX-EMB 在 SST 数据集上效果一般,但是在 NoReCeval 上效果较好
  4. STL 在两个任务上比 BOW、LEX-EMB 都要好,而且在 NoReCeval 上都好
  5. MTL 完胜其他模型
辅助任务性能对比

下表为评估 MTL 和 LEX-EMB 模型在辅助词典预测任务上的性能。

image.png

表 5 显示,LEX-EMB 模型在英语和挪威语上的 MTL 模型优于 MTL 模型。

假设差异是由于任务相似性引起的,而不是归因于语言的差异。对于英语而言,辅助任务更能预测主要任务(句子级别的情感),而对于挪威语,预测评估,事实暗示和非评估的主要任务并不十分取决于单词级别的性质。因此,挪威语中的 MTL 分类器较少依赖于辅助模块。

错误分析

通过相对混淆矩阵,对比 MTL 和 STL 两种架构在各种标签上预测的数量差异。其中,深紫色表明 MTL 预测数量比 STL 要多,反之白色表明要少。

SST 数据集预测数量差异NoReCeval 数据集预测数量差异
image.pngimage.png

在 SST 数据集上的预测数量差异表明,MTL 架构在正确预测情感极性强(StrongNeg、StrongPos)和中性的更多,但是对于一般极性的预测偏少。

在 NoReCeval 数据集上,MTL 架构在预测 Fact-implied、Non-evaluative 正确预测的数量多,在 Evaluate 上预测出来的数量少。

image.png

上表展示 MTL 比 STL 更好或更糟的样例。

Gold、STL、MTL 分别表示真实标签、STL 预测标签、MTL 预测标签。红色和蓝色框分别表示通过辅助任务训练得到的消极情感词和积极情感词。

模型鲁棒性

image.png

  1. 使用词典有助于预测单词情感极性

  2. MTL 模型使用词典,MacroF1 的得分普遍高于 STL 模型。表明 MTL 模型对不同情感信息来源的鲁棒性。关于鲁棒性的解释:模型在面对不同来源的情感信息时,仍然能够保持较好的性能。换句话说,MTL 模型对不同的情感词典都表现出了较好的适应能力,不会因为词典的不同而导致性能大幅波动。

  3. 数据集的大小似乎比具体内容更重要,因为所有超过4000个词的词典都取得了类似的分数。

结论、改进和展望

结论

  1. 使用英文和挪威文情感词典上做了词级的情感实验,本文方法相较于「单任务学习」有性能提升。

  2. 多任务目标有助于中性和少数类(the multi-task objective tends to help the neutral and minority classes, indicating a regularizing effect.)

改进和展望

  1. 模型忽视子词信息(如unimpressive)和多词表达(如not my cup of tea),如果能包括这些信息能有效提升结果

  2. Although we have limited the scope of our auxiliary task to binary classification, using a regression task with sentiment and emotion labels may provide more fine-grained signal to the classifier. 二元分类任务 -> 带有情感及情绪标签的回归任务:判断情绪类别,并提供情绪的强烈程度(回归任务输出一个连续的数值,区分情感间的差异)

  3. 增加方面级分类任务。"这部电影剧情精彩,但特效一般"涉及两个方面,"剧情"方面为积极;"特效"方面为消极

  4. MTL 方法能将其他类型的外部知识引入神经分类器中,用于除情感分析以外的其他类型的任务。

Looking in indexes: https://pypi.python.org/simple Collecting cryptography Downloading cryptography-45.0.6.tar.gz (744 kB) ---------------------------------------- 744.9/744.9 kB 3.2 MB/s 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: cffi>=1.14 in d:\desktop\乐骐编程\python 3.13.5\lib\site-packages (from cryptography) (1.17.1) Requirement already satisfied: pycparser in d:\desktop\乐骐编程\python 3.13.5\lib\site-packages (from cffi>=1.14->cryptography) (2.22) Building wheels for collected packages: cryptography Building wheel for cryptography (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for cryptography (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [189 lines of output] Running `maturin pep517 build-wheel -i D:\Desktop\乐骐编程\python 3.13.5\python3.13t.exe --compatibility off` 馃嵐 Building a mixed python/rust project 馃敆 Found pyo3 bindings with abi3 support 馃悕 Found CPython 3.13t at D:\Desktop\涔愰獝缂栫▼\python 3.13.5\python3.13t.exe 馃摗 Using build options locked from pyproject.toml 鈿狅笍 Warning: CPython 3.13t at D:\Desktop\涔愰獝缂栫▼\python 3.13.5\python3.13t.exe does not yet support abi3 so the build artifacts will be version-specific. Compiling target-lexicon v0.13.2 Compiling proc-macro2 v1.0.95 Compiling unicode-ident v1.0.18 Compiling shlex v1.3.0 Compiling once_cell v1.21.3 Compiling vcpkg v0.2.15 Compiling pkg-config v0.3.32 Compiling libc v0.2.172 Compiling cc v1.2.23 Compiling autocfg v1.4.0 Compiling openssl v0.10.72 Compiling foreign-types-shared v0.1.1 Compiling memoffset v0.9.1 Compiling heck v0.5.0 Compiling foreign-types v0.3.2 Compiling cfg-if v1.0.0 Compiling bitflags v2.9.1 Compiling itoa v1.0.15 Compiling indoc v2.0.6 Compiling unindent v0.2.4 Compiling cryptography-key-parsing v0.1.0 (C:\Users\awei006\AppData\Local\Temp\pip-install-ptzrqy6d\cryptography_dffa39c3c63c4ae4b53a322803c200d9\src\rust\cryptography-key-parsing) Compiling pyo3-build-config v0.25.0 Compiling quote v1.0.40 Compiling cryptography-openssl v0.1.0 (C:\Users\awei006\AppData\Local\Temp\pip-install-ptzrqy6d\cryptography_dffa39c3c63c4ae4b53a322803c200d9\src\rust\cryptography-openssl) Compiling base64 v0.22.1 Compiling self_cell v1.2.0 Compiling syn v2.0.101 Compiling pem v3.0.5 Compiling openssl-sys v0.9.108 Compiling cryptography-cffi v0.1.0 (C:\Users\awei006\AppData\Local\Temp\pip-install-ptzrqy6d\cryptography_dffa39c3c63c4ae4b53a322803c200d9\src\rust\cryptography-cffi) warning: openssl-sys@0.9.108: Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set the `OPENSSL_DIR` environment variable for the compilation process. See stderr section below for further information. error: failed to run custom build command for `openssl-sys v0.9.108` Caused by: process didn't exit successfully: `C:\Users\awei006\AppData\Local\Temp\pip-install-ptzrqy6d\cryptography_dffa39c3c63c4ae4b53a322803c200d9\target\release\build\openssl-sys-81bfb0a89f2ad101\build-script-main` (exit code: 101) --- stdout cargo:rustc-check-cfg=cfg(osslconf, values("OPENSSL_NO_OCB", "OPENSSL_NO_SM4", "OPENSSL_NO_SEED", "OPENSSL_NO_CHACHA", "OPENSSL_NO_CAST", "OPENSSL_NO_IDEA", "OPENSSL_NO_CAMELLIA", "OPENSSL_NO_RC4", "OPENSSL_NO_BF", "OPENSSL_NO_PSK", "OPENSSL_NO_DEPRECATED_3_0", "OPENSSL_NO_SCRYPT", "OPENSSL_NO_SM3", "OPENSSL_NO_RMD160", "OPENSSL_NO_EC2M", "OPENSSL_NO_OCSP", "OPENSSL_NO_CMS", "OPENSSL_NO_COMP", "OPENSSL_NO_SOCK", "OPENSSL_NO_STDIO", "OPENSSL_NO_EC", "OPENSSL_NO_SSL3_METHOD", "OPENSSL_NO_KRB5", "OPENSSL_NO_TLSEXT", "OPENSSL_NO_SRP", "OPENSSL_NO_RFC3779", "OPENSSL_NO_SHA", "OPENSSL_NO_NEXTPROTONEG", "OPENSSL_NO_ENGINE", "OPENSSL_NO_BUF_FREELISTS", "OPENSSL_NO_RC2")) cargo:rustc-check-cfg=cfg(openssl) cargo:rustc-check-cfg=cfg(libressl) cargo:rustc-check-cfg=cfg(boringssl) cargo:rustc-check-cfg=cfg(awslc) cargo:rustc-check-cfg=cfg(libressl250) cargo:rustc-check-cfg=cfg(libressl251) cargo:rustc-check-cfg=cfg(libressl252) cargo:rustc-check-cfg=cfg(libressl261) cargo:rustc-check-cfg=cfg(libressl270) cargo:rustc-check-cfg=cfg(libressl271) cargo:rustc-check-cfg=cfg(libressl273) cargo:rustc-check-cfg=cfg(libressl280) cargo:rustc-check-cfg=cfg(libressl281) cargo:rustc-check-cfg=cfg(libressl291) cargo:rustc-check-cfg=cfg(libressl310) cargo:rustc-check-cfg=cfg(libressl321) cargo:rustc-check-cfg=cfg(libressl332) cargo:rustc-check-cfg=cfg(libressl340) cargo:rustc-check-cfg=cfg(libressl350) cargo:rustc-check-cfg=cfg(libressl360) cargo:rustc-check-cfg=cfg(libressl361) cargo:rustc-check-cfg=cfg(libressl370) cargo:rustc-check-cfg=cfg(libressl380) cargo:rustc-check-cfg=cfg(libressl381) cargo:rustc-check-cfg=cfg(libressl382) cargo:rustc-check-cfg=cfg(libressl390) cargo:rustc-check-cfg=cfg(libressl400) cargo:rustc-check-cfg=cfg(libressl410) cargo:rustc-check-cfg=cfg(ossl101) cargo:rustc-check-cfg=cfg(ossl102) cargo:rustc-check-cfg=cfg(ossl102f) cargo:rustc-check-cfg=cfg(ossl102h) cargo:rustc-check-cfg=cfg(ossl110) cargo:rustc-check-cfg=cfg(ossl110f) cargo:rustc-check-cfg=cfg(ossl110g) cargo:rustc-check-cfg=cfg(ossl110h) cargo:rustc-check-cfg=cfg(ossl111) cargo:rustc-check-cfg=cfg(ossl111b) cargo:rustc-check-cfg=cfg(ossl111c) cargo:rustc-check-cfg=cfg(ossl111d) cargo:rustc-check-cfg=cfg(ossl300) cargo:rustc-check-cfg=cfg(ossl310) cargo:rustc-check-cfg=cfg(ossl320) cargo:rustc-check-cfg=cfg(ossl330) cargo:rustc-check-cfg=cfg(ossl340) cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_GNU_OPENSSL_LIB_DIR X86_64_PC_WINDOWS_GNU_OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=OPENSSL_LIB_DIR OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_GNU_OPENSSL_INCLUDE_DIR X86_64_PC_WINDOWS_GNU_OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_GNU_OPENSSL_DIR X86_64_PC_WINDOWS_GNU_OPENSSL_DIR unset cargo:rerun-if-env-changed=OPENSSL_DIR OPENSSL_DIR unset cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG cargo:rerun-if-env-changed=OPENSSL_STATIC cargo:rerun-if-env-changed=OPENSSL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH cargo:rerun-if-env-changed=PKG_CONFIG_PATH cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR cargo:rerun-if-env-changed=OPENSSL_STATIC cargo:rerun-if-env-changed=OPENSSL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH cargo:rerun-if-env-changed=PKG_CONFIG_PATH cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR Could not find openssl via pkg-config: Could not run `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags openssl` The pkg-config command could not be found. Most likely, you need to install a pkg-config package for your OS. If you've already installed it, ensure the pkg-config command is one of the directories in the PATH environment variable. If you did not expect this build to link to a pre-installed system library, then check documentation of the openssl-sys crate for an option to build the library from source, or disable features or dependencies that require pkg-config. note: vcpkg did not find openssl: the vcpkg-rs Vcpkg build helper can only find libraries built for the MSVC ABI. cargo:warning=Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set the `OPENSSL_DIR` environment variable for the compilation process. See stderr section below for further information. --- stderr Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set the `OPENSSL_DIR` environment variable for the compilation process. Make sure you also have the development packages of openssl installed. For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora. If you're in a situation where you think the directory *should* be found automatically, please open a bug at https://github.com/sfackler/rust-openssl and include information about your system as well as this message. $HOST = x86_64-pc-windows-gnu $TARGET = x86_64-pc-windows-gnu openssl-sys = 0.9.108 It looks like you're compiling for MinGW but you may not have either OpenSSL or pkg-config installed. You can install these two dependencies with: pacman -S openssl-devel pkgconf and try building this crate again. warning: build failed, waiting for other jobs to finish... 馃挜 maturin failed Caused by: Failed to build a native library through cargo Caused by: Cargo build finished with "exit code: 101": `"cargo" "rustc" "--message-format" "json-render-diagnostics" "--locked" "--manifest-path" "C:\\Users\\awei006\\AppData\\Local\\Temp\\pip-install-ptzrqy6d\\cryptography_dffa39c3c63c4ae4b53a322803c200d9\\src\\rust\\Cargo.toml" "--release" "--lib"` Error: command ['maturin', 'pep517', 'build-wheel', '-i', 'D:\\Desktop\\乐骐编程\\python 3.13.5\\python3.13t.exe', '--compatibility', 'off'] returned non-zero exit status 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for cryptography Failed to build cryptography error: failed-wheel-build-for-install × Failed to build installable wheels for some pyproject.toml based projects ╰─> cryptography
08-29
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值