Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法安装环境lxml4.9.1 #594

Open
MystFeng opened this issue Jul 3, 2024 · 5 comments
Open

无法安装环境lxml4.9.1 #594

MystFeng opened this issue Jul 3, 2024 · 5 comments
Labels
failed 程序运行出错

Comments

@MystFeng
Copy link

MystFeng commented Jul 3, 2024

为了更好的解决问题,请认真回答下面的问题。等到问题解决,请及时关闭本issue。

  • 问:请您指明哪个版本运行出错(github版/PyPi版/全部)?

答:全部

  • 问:您使用的是否是最新的程序(是/否)?

答:是

(还没安装,所以中间问题我删了)

  • 问:如果方便,请您描述出错详情,最好附上错误提示。

答:

我的python是3.12.2版本,半年前我安装过一次,也是这个问题。且pip版也不能运行之后输出config文件。

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting lxml==4.9.1
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/70/bb/7a2c7b4f8f434aa1ee801704bf08f1e53d7b5feba3d5313ab17003477808/lxml-4.9.1.tar.gz (3.4 MB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: lxml
Building wheel for lxml (setup.py): started
Building wheel for lxml (setup.py): finished with status 'error'
Running setup.py clean for lxml
Failed to build lxml

error: subprocess-exited-with-error

python setup.py bdist_wheel did not run successfully.
exit code: 1

[98 lines of output]
C:\Users\delic\AppData\Local\Temp\pip-install-ld0_bx1a\lxml_263f5e86485c430c8115978e602d5c37\setup.py:114: SyntaxWarning: invalid escape sequence '.'
is_interesting_header = re.compile('^(zconf|zlib|.*charset).h$').match
Building lxml version 4.9.1.
C:\Users\delic\AppData\Local\Temp\pip-install-ld0_bx1a\lxml_263f5e86485c430c8115978e602d5c37\setup.py:67: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
Building without Cython.
Building against pre-built libxml2 andl libxslt libraries
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-312
creating build\lib.win-amd64-cpython-312\lxml
copying src\lxml\builder.py -> build\lib.win-amd64-cpython-312\lxml
copying src\lxml\cssselect.py -> build\lib.win-amd64-cpython-312\lxml
copying src\lxml\doctestcompare.py -> build\lib.win-amd64-cpython-312\lxml
copying src\lxml\ElementInclude.py -> build\lib.win-amd64-cpython-312\lxml
copying src\lxml\pyclasslookup.py -> build\lib.win-amd64-cpython-312\lxml
copying src\lxml\sax.py -> build\lib.win-amd64-cpython-312\lxml
copying src\lxml\usedoctest.py -> build\lib.win-amd64-cpython-312\lxml
copying src\lxml_elementpath.py -> build\lib.win-amd64-cpython-312\lxml
copying src\lxml_init_.py -> build\lib.win-amd64-cpython-312\lxml
creating build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes_init_.py -> build\lib.win-amd64-cpython-312\lxml\includes
creating build\lib.win-amd64-cpython-312\lxml\html
copying src\lxml\html\builder.py -> build\lib.win-amd64-cpython-312\lxml\html
copying src\lxml\html\clean.py -> build\lib.win-amd64-cpython-312\lxml\html
copying src\lxml\html\defs.py -> build\lib.win-amd64-cpython-312\lxml\html
copying src\lxml\html\diff.py -> build\lib.win-amd64-cpython-312\lxml\html
copying src\lxml\html\ElementSoup.py -> build\lib.win-amd64-cpython-312\lxml\html
copying src\lxml\html\formfill.py -> build\lib.win-amd64-cpython-312\lxml\html
copying src\lxml\html\html5parser.py -> build\lib.win-amd64-cpython-312\lxml\html
copying src\lxml\html\soupparser.py -> build\lib.win-amd64-cpython-312\lxml\html
copying src\lxml\html\usedoctest.py -> build\lib.win-amd64-cpython-312\lxml\html
copying src\lxml\html_diffcommand.py -> build\lib.win-amd64-cpython-312\lxml\html
copying src\lxml\html_html5builder.py -> build\lib.win-amd64-cpython-312\lxml\html
copying src\lxml\html_setmixin.py -> build\lib.win-amd64-cpython-312\lxml\html
copying src\lxml\html_init_.py -> build\lib.win-amd64-cpython-312\lxml\html
creating build\lib.win-amd64-cpython-312\lxml\isoschematron
copying src\lxml\isoschematron_init_.py -> build\lib.win-amd64-cpython-312\lxml\isoschematron
copying src\lxml\etree.h -> build\lib.win-amd64-cpython-312\lxml
copying src\lxml\etree_api.h -> build\lib.win-amd64-cpython-312\lxml
copying src\lxml\lxml.etree.h -> build\lib.win-amd64-cpython-312\lxml
copying src\lxml\lxml.etree_api.h -> build\lib.win-amd64-cpython-312\lxml
copying src\lxml\includes\c14n.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\config.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\dtdvalid.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\etreepublic.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\htmlparser.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\relaxng.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\schematron.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\tree.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\uri.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\xinclude.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\xmlerror.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\xmlparser.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\xmlschema.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\xpath.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\xslt.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes_init_.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\etree_defs.h -> build\lib.win-amd64-cpython-312\lxml\includes
copying src\lxml\includes\lxml-version.h -> build\lib.win-amd64-cpython-312\lxml\includes
creating build\lib.win-amd64-cpython-312\lxml\isoschematron\resources
creating build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\rng
copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\rng
creating build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl
copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl
copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl
creating build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
running build_ext
building 'lxml.etree' extension
creating build\temp.win-amd64-cpython-312
creating build\temp.win-amd64-cpython-312\Release
creating build\temp.win-amd64-cpython-312\Release\src
creating build\temp.win-amd64-cpython-312\Release\src\lxml
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc\lxml\includes -IC:\Users\delic\AppData\Local\Programs\Python\Python312\include -IC:\Users\delic\AppData\Local\Programs\Python\Python312\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" /Tcsrc\lxml\etree.c /Fobuild\temp.win-amd64-cpython-312\Release\src\lxml\etree.obj -w
cl: 命令行 warning D9025 :正在重写“/W3”(用“/w”)
etree.c
C:\Users\delic\AppData\Local\Temp\pip-install-ld0_bx1a\lxml_263f5e86485c430c8115978e602d5c37\src\lxml\includes/etree_defs.h(14): fatal error C1083: 无法打开包括文件: “libxml/xmlversion.h”: No such file or directory
Compile failed: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX86\x64\cl.exe' failed with exit code 2
creating Users
creating Users\delic
creating Users\delic\AppData
creating Users\delic\AppData\Local
creating Users\delic\AppData\Local\Temp
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I/usr/include/libxml2 "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" /TcC:\Users\delic\AppData\Local\Temp\xmlXPathInitgk1k945o.c /FoUsers\delic\AppData\Local\Temp\xmlXPathInitgk1k945o.obj
xmlXPathInitgk1k945o.c
C:\Users\delic\AppData\Local\Temp\xmlXPathInitgk1k945o.c(1): fatal error C1083: 无法打开包括文件: “libxml/xpath.h”: No such file or directory


Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?


error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX86\x64\cl.exe' failed with exit code 2
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for lxml
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (lxml)

@MystFeng MystFeng added the failed 程序运行出错 label Jul 3, 2024
@dataabc
Copy link
Owner

dataabc commented Jul 3, 2024

本程序需要用到lxml,这个我也无能为力。

@MystFeng
Copy link
Author

MystFeng commented Jul 3, 2024

最新版的lxml能运行吗

@dataabc
Copy link
Owner

dataabc commented Jul 3, 2024

应该可以。

@2OUMERTH
Copy link

2OUMERTH commented Jul 9, 2024

这个问题可能是你本来有lxml了,但并非4.9.1版本的。你可以检查下你的lxml是什么版本的,然后把requirement.txt文件中的lxml改成对应版本,再次运行。关于config.jason文件不运行的问题,在文件夹下复制原有的config_simple文件,重命名为config后粘贴,在新的config里边更改参数,然后运行,在master的目录下执行命令:python -m weibo_spider

@Noah-Liu-1867
Copy link

你试着用“python -m weibo_spider”而不是“python3 -m weibo_spider”看看。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
failed 程序运行出错
Projects
None yet
Development

No branches or pull requests

4 participants