使用pip /添加PyYaml作为pip依赖项安装pyyaml

 你是我的梦境吗_574 发布于 2023-01-02 15:25

我想在我的pip项目中使用PyYaml,但是在使用它作为依赖项时遇到了麻烦.主要问题是pip中的PyYaml不是跨平台安装.

如何使用pip安装pyyaml以使其正常工作.注意,在当前新的Ubuntu安装上,运行时出现以下错误pip install pyyaml

Installing collected packages: pyyaml
  Running setup.py install for pyyaml
    checking if libyaml is compilable
    gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -I/usr/include/python3.2mu -c build/temp.linux-x86_64-3.2/check_libyaml.c -o build/temp.linux-x86_64-3.2/check_libyaml.o
    build/temp.linux-x86_64-3.2/check_libyaml.c:2:18: fatal error: yaml.h: No such file or directory
    compilation terminated.

    libyaml is not found or a compiler error: forcing --without-libyaml
    (if libyaml is installed correctly, you may need to
     specify the option --include-dirs or uncomment and
     modify the parameter include_dirs in setup.cfg)

Successfully installed pyyaml

请注意,错误显示"已成功安装",但事实并非如此.我不能import yaml

由于我的第一句话,我不是在寻找说"使用apt-get"的答案.我需要安装是跨平台的,并作为一个pip依赖工作我不是简单地想知道如何正确安装它.

如果这是不可能的,我可以使用任何替换库吗?

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有