- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我构建 libyaml 并将其安装到本地区域:
yaml-0.1.5 $ ./configure --prefix=/usr/local/sqlminus
yaml-0.1.5 $ make install
yaml-0.1.5 $ ls -l /usr/local/sqlminus/include/yaml.h
-rw-r--r--@ 1 mh admin 54225 Jan 5 09:05 /usr/local/sqlminus/include/yaml.h
但是当我构建 PyYAML 时,它找不到 yaml.h。
PyYAML-3.11 $ /usr/local/sqlminus/bin/python setup.py build
checking if libyaml is compilable
gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall
-Wstrict-prototypes -I/usr/local/sqlminus/include/python2.7
-c build/temp.macosx-10.4-x86_64-2.7/check_libyaml.c
-o build/temp.macosx-10.4-x86_64-2.7/check_libyaml.o
build/temp.macosx-10.4-x86_64-2.7/check_libyaml.c:2:10:
fatal error: 'yaml.h'
file not found
#include <yaml.h>
^
1 error generated.
如何告诉 PyYAML 我在哪里安装了 libyaml?
最佳答案
(更新)根据下面的dotslash评论,编辑setup.cfg并添加这两行使一切顺利进行。
include_dirs=/usr/local/sqlminus/include
library_dirs=/usr/local/sqlminus/lib
(结束更新)
我认为你应该安装依赖项。
如果您使用的是基于 Ubuntu 或 Debian 的系统,您可以通过此搜索
apt-cache search libyaml
然后你可能会发现有一些相关的包。
我建议你尝试安装这个:apt-get install libyaml-dev -y
如果您使用的是 Mac OS,您可以更改文件 check_libyaml.c
中的源代码,告诉它 yaml.h 的绝对路径是什么。
或者直接编译时指定路径
python setup.py config --with-includepath=/path/to/your/install/of/python/includes/
然后去编译。
更多信息可以找到here .
希望这对您有所帮助。
关于python - PyYAML:如何指定包含目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34617464/
我想在我的 pip 项目中使用 PyYaml,但在将其用作依赖项时遇到了麻烦。主要问题是 pip 中的 PyYaml 不是跨平台安装。 如何使用 pip 安装 pyyaml 以使其正常工作。请注意,在
这个问题在这里已经有了答案: Pip install from pypi works, but from testpypi fails (cannot find requirements) (2 个回
我想用 PyYaml 解释以下 YAML 字符串: - !Table header: - !Column - !Paragrap
yaml.load将数字加载为 Python 浮点数。我找不到一种直接的方法来覆盖它。 比较 json.load , 允许 parse_float=Decimal如果你想将浮点数解析为 decimal
我认为加载 .yml file 时出现内存泄漏使用库 PyYAML。 我已按照以下步骤操作: import yaml d = yaml.load(open(filename, 'r')) 进程使用的内
我需要使用 pyyaml 将 dict 导出到 yaml,不带“-” export_dash_dict = {} export_dash_dict["dashboards"] = []
在下面的代码中,我创建了 net_plan_dict 变量字典并将其转换为 YAML 格式文件。在字典中,我有一个名为 addresses 的字段,它是一个包含三个元素的数组。创建 YAML 文件后,
我构建 libyaml 并将其安装到本地区域: yaml-0.1.5 $ ./configure --prefix=/usr/local/sqlminus yaml-0.1.5 $ make inst
这个问题已经有答案了: New PyYAML version breaks on most custom python objects - RepresenterError (1 个回答) 已关闭 5
我正在尝试理解关于 https://pyyaml.org/wiki/PyYAML 的声明那: PyYAML features - a complete YAML 1.1 parser. In part
看起来好像 PyYAML 将字符串 10:01 解释为以秒为单位的持续时间: import yaml >>> yaml.load("time: 10:01") {'time': 601} 官方文档没有
尝试获取 YAML 文档以解析为我可以操作的 python 字典对象。我安装了 pip install pyyaml。 import yaml yamlstring = "some: var \n a
所以我有一个 yaml 文件,里面有很多琐碎的问题和一个答案列表。但是,每当我尝试加载此文件并使用 pyyaml 将内容转储到 python 中时,它都会向后转储它们。我不确定这是我的 yaml 文件
当用很长的键转储字典时,我得到这样的结果: ? ns=4;s=|var|CODESYS Control for Raspberry Pi SL.Application.GVL.Data.DateTim
我想将一些配置参数从 YAML 直接映射到 Python 参数名称。只是想知道是否有一种方法无需编写额外代码(之后修改键)让 YAML 解析器用下划线“_”替换键中的破折号“-”。 some-para
这个问题在这里已经有了答案: Parsing YAML, return with line number (4 个答案) 关闭 1 年前。 有什么方法可以配置 PyYAML 以便我可以获得与给定节点
我有以下 Python 2.6 程序和 YAML 定义(使用 PyYAML ): import yaml x = yaml.load( """ product:
我有以下 YAML 文件: --- my_vars: my_env: "dev" my_count: 3 当我用 PyYAML 读取它并再次转储它时,我得到以下输出: --- my_vars:
我正在开发一个使用 Unity3D 游戏引擎的项目。对于某些管道要求,最好能够使用 Python 从外部工具更新某些文件。 Unity 的 meta 和 anim 文件在 YAML 中,所以我认为使用
我有一个 python 项目,我想在其中使用 YAML (pyYaml 3.11),特别是因为它“漂亮”并且用户可以在必要时轻松地在文本编辑器中进行编辑。不过,我的问题是,如果我将 YAML 引入 p
我是一名优秀的程序员,十分优秀!