Failing to load packages with pycharm

有些话、适合烂在心里 提交于 2020-01-05 07:34:07

问题


I am trying to do some web scrapping using python with PyCharm on a windows 10 machine. Some sites suggest using lxml library and it sounds good. I am trying to load the package but am having trouble. What should I do?

OK great. I go to add lxml 3.6.4 in the package installer and it fails with the message(s):

ERROR: b"'xslt-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"

and

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

I installed libxml2dom via the package installer but that does not do the trick

xslt-config is not one of the available packages in the available packages installer libxml2 is also not an available package

I do not see "libxml2" from the options of available packages. But I do see "libxml2-python" 2.6.21 I tried to install it, but it fails with the message:

Collecting libxml2-python==2.6.21
Could not find a version that satisfies the requirement libxml2-python==2.6.21 (from versions: )

No matching distribution found for libxml2-python==2.6.21

I have been able to load other packages Using python interpreter 3.5.2 Using PyCharm Community Edition 2016.2.3


回答1:


lxml needs C/C++ libraries libxml, libxstl so you have to install it first. But they are not Python modules but standard libraries - probably libxml.dll, libxstl.dll.

lxml may need also source code for this libraries or C/C++ header files *.h and C/C++ compiler to compile lxml

For Windows exists Unofficial Windows Binaries for Python Extension Packages with precompiled modules and there is lxml

But much easier (for Windows user) is use Anaconda distribution which installs the same Python from Python.org but with extra, precompiled modules like lxml. See list of modules.

PyCharm can use different Python with different project so you can have installed current Python and Anaconda and use them both in PyCharm.



来源:https://stackoverflow.com/questions/40641916/failing-to-load-packages-with-pycharm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!