安装XML :: Parser需要expat.h [英] Installing XML::Parser requires expat.h

查看:594
本文介绍了安装XML :: Parser需要expat.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个需要将所有第三方(阅读:CPAN)perl模块安装在perforce存储库中的项目,这样依赖于它们的任何代码都可以成功运行,而无需其他人手动安装他们.我在尝试安装XML :: Parser时遇到了一个问题.我使用cpanminus安装我的CPAN模块,因此我在所需目录中运行了cpanm -L . XML::Parser(此操作以前已与其他模块一起使用)并出现错误:

I'm working on a project that requires all third-party (read: CPAN) perl modules to be installed in a perforce repository, so that any code that depends on them can be successfully run without anyone else needing to manually install them. I ran into an issue though when trying to install XML::Parser. I use cpanminus to install my CPAN modules, so I ran cpanm -L . XML::Parser in the desired directory (this has worked before with other modules) and got the error:

Expat.xs:12:19: error: expat.h: No such file or directory

我曾经使用过Ubuntu和apt-get,但是在工作中我必须使用RedHat,而且我不确定如何将expat安装到本地目录.我跑了yum search expat并得到了

I'm used to using Ubuntu and apt-get, but at work I have to use RedHat and I'm not sure how to install expat to a local directory. I ran yum search expat and got

expat.i386 : A library for parsing XML.
expat.x86_64 : A library for parsing XML.

所以我尝试了yum install --installroot=. expat.i386并收到以下错误:

So I tried yum install --installroot=. expat.i386 and got the following errors:

Loaded plugins: rhnplugin, security
error: cannot open Packages index using db3 - No such file or directory (2)
error: cannot open Packages database in ./var/lib/rpm
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in ?
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 309, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 157, in main
    base.getOptionsConfig(args)
  File "/usr/share/yum-cli/cli.py", line 187, in getOptionsConfig
    self.conf
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 665, in <lambda>
    conf = property(fget=lambda self: self._getConfig(),
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 240, in _getConfig
    self._conf = config.readMainConfig(startupconf)
  File "/usr/lib/python2.4/site-packages/yum/config.py", line 804, in readMainConfig
    yumvars['releasever'] = _getsysver(startupconf.installroot, startupconf.distroverpkg)
  File "/usr/lib/python2.4/site-packages/yum/config.py", line 877, in _getsysver
    idx = ts.dbMatch('provides', distroverpkg)
TypeError: rpmdb open failed

我做错了什么?另外,一旦我安装了expat,就不确定如何告诉cpanm在哪里找到它.

What am I doing wrong? Also, once I do get expat installed, I'm not sure how I would tell cpanm where to find it.

推荐答案

好吧,我找到了一种解决方法.我安装了XML :: Simple.最初,它看起来像XML :: Simple所需的XML :: Parser,但经过一番寻找,发现它需要XML :: Parser或XML :: SAX,所以我安装了XML :: SAX并让XML :: Simple正常工作.足够满足我的需求.

Well, I found a workaround. I installed XML::Simple instead. At first it looked like XML::Simple required XML::Parser, but after some looking found out that it requires either XML::Parser OR XML::SAX, so I installed XML::SAX instead and got XML::Simple working. Good enough for my needs.

这篇关于安装XML :: Parser需要expat.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆