尝试为 Windows 10 安装 HTML5 解析器pkg-config

问题描述

目前我正在编写一个脚本来进行一些网络抓取,但我的问题是我无法通过 pip 应用程序安装 html5-parser。我做了人们 herehere 所说的一切,但现在当我尝试使用“pip install html5-parser”时仍然出现错误

这就是我现在使用“pip install html5-parser”时得到的:

C:\WINDOWS\system32>pip install html5-parser
Collecting html5-parser
  Using cached html5-parser-0.4.9.tar.gz (274 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\program files\python39\python.exe' -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'C:\\Users\\Study\\AppData\\Local\\Temp\\pip-install-b3vcdzf6\\html5-parser\\setup.py'"'"'; __file__='"'"'C:\\Users\\Study\\AppData\\Local\\Temp\\pip-install-b3vcdzf6\\html5-parser\\setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Study\AppData\Local\Temp\pip-pip-egg-info-9nmoi2ur'
         cwd: C:\Users\Study\AppData\Local\Temp\pip-install-b3vcdzf6\html5-parser\
    Complete output (17 lines):
    Package libxml-2.0 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libxml-2.0.pc'
    to the PKG_CONfig_PATH environment variable
    No package 'libxml-2.0' found
    Traceback (most recent call last):
      File "<string>",line 1,in <module>
      File "C:\Users\Study\AppData\Local\Temp\pip-install-b3vcdzf6\html5-parser\setup.py",line 79,in <module>
        include_dirs=include_dirs(),File "C:\Users\Study\AppData\Local\Temp\pip-install-b3vcdzf6\html5-parser\build.py",line 94,in include_dirs
        return [x[2:] for x in pkg_config('libxml-2.0','--cflags-only-I')]
      File "C:\Users\Study\AppData\Local\Temp\pip-install-b3vcdzf6\html5-parser\build.py",line 76,in pkg_config
        val = subprocess.check_output([PKGCONfig,pkg] + list(args)).decode('utf-8')
      File "c:\program files\python39\lib\subprocess.py",line 420,in check_output
        return run(*popenargs,stdout=PIPE,timeout=timeout,check=True,File "c:\program files\python39\lib\subprocess.py",line 524,in run
        raise CalledProcessError(retcode,process.args,subprocess.CalledProcessError: Command '['pkg-config','libxml-2.0','--cflags-only-I']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我的 pkg-config 文件安装在“C:\pkg-config\bin”下,并且此路径已添加到我的系统路径变量中。

我也尝试过使用命令“pip install pkgconfig”安装 pkg config,但没有做任何事情。

希望有人能帮助我。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)