gpt4 book ai didi

linux - 在没有 root 或 sudo 的情况下安装 PyYAML 和 libyaml

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:09:11 26 4
gpt4 key购买 nike

我需要使用 libyaml 绑定(bind)设置 PyYAML。我正在使用 5.7 版的 Red Hat Enterprise Linux 客户端,并且在 /tools/Devel/epd_free-7.3-2rh5-x86_64 下安装了 Enthought Python 7.3.2 的本地副本并将 /tools/Devel/epd_free-7.3-2rh5-x86_64/bin 添加到 $PATH

我正在处理这个本地副本,因为我在机器上没有 root 或 sudo 访问权限。

要安装 libyaml 我已经完成了:

tar -xvzf yaml-0.1.5.tar.gz
cd yaml-0.1.5
./configure prefix=/tools/Devel/epd_free-7.3-2-rh5-x86_64
make
make install

它创造了

/tools/Devel/epd_free-7.3-2rh5-x86_64/include/yaml.h

还有

/tools/Devel/epd_free-7.3-2rh5-x86_64/lib/libyaml-0.so.2
/tools/Devel/epd_free-7.3-2rh5-x86_64/lib/libyaml-0.so.2.0.3
/tools/Devel/epd_free-7.3-2rh5-x86_64/lib/libyaml.a
/tools/Devel/epd_free-7.3-2rh5-x86_64/lib/libyaml.la
/tools/Devel/epd_free-7.3-2rh5-x86_64/lib/libyaml.so
/tools/Devel/epd_free-7.3-2rh5-x86_64/lib/pkgconfig

但是,当我尝试安装 PyYAML 时,我得到了

pip install PyYAML

Downloading/unpacking PyYAML
Downloading PyYAML-3.11.tar.gz (248kB): 248kB downloaded
Running setup.py (path:/tmp/pip_build_greglac/PyYAML/setup.py) egg_info for package PyYAML

Installing collected packages: PyYAML
Running setup.py install for PyYAML
checking if libyaml is compilable
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -O2 -fPIC -I/tools/Devel/epd_free-7.3-2-rh5-x86_64/include/python2.7 -c build/temp.linux-x86_64-2.7/check_libyaml.c -o build/temp.linux-x86_64-2.7/check_libyaml.o
build/temp.linux-x86_64-2.7/check_libyaml.c:2:18: error: yaml.h: No such file or directory
build/temp.linux-x86_64-2.7/check_libyaml.c: In function âmainâ:
build/temp.linux-x86_64-2.7/check_libyaml.c:5: error: âyaml_parser_tâ undeclared (first use in this function)
build/temp.linux-x86_64-2.7/check_libyaml.c:5: error: (Each undeclared identifier is reported only once
build/temp.linux-x86_64-2.7/check_libyaml.c:5: error: for each function it appears in.)
build/temp.linux-x86_64-2.7/check_libyaml.c:5: error: expected â;â before âparserâ
build/temp.linux-x86_64-2.7/check_libyaml.c:6: error: âyaml_emitter_tâ undeclared (first use in this function)
build/temp.linux-x86_64-2.7/check_libyaml.c:6: error: expected â;â before âemitterâ
build/temp.linux-x86_64-2.7/check_libyaml.c:8: error: âparserâ undeclared (first use in this function)
build/temp.linux-x86_64-2.7/check_libyaml.c:11: error: âemitterâ undeclared (first use in this function)

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
Cleaning up...

我假设这是因为 PyYAML 正在默认位置寻找 libyaml。是否可以为 pyyaml 安装指定 libyaml 的位置?

最佳答案

使用https://pypi.python.org/simple/pyyaml/并下载 PyYAML-3.11.tar.gz 在 Windows 中对我有用

然后我解压它,打开后我在这个位置写了命令 setup.py install

其他包搜索 https://pypi.python.org/simple

关于linux - 在没有 root 或 sudo 的情况下安装 PyYAML 和 libyaml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24167549/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com