What is python-dev package used for

*爱你&永不变心* 提交于 2019-11-27 00:20:38

问题


I recently installed lxml.

Before that I had to install all the dependencies for that. So I tried to install liblxml2-dev, liblxslt1-dev and python-dev (google searched for what packages are required for lxml)

but even after that I could not able to install lxml by using the command pip install lxml.

However as because I am using Python 3.4.0, I thought that may be there are different version of python-dev (thought came due to facing some similar version conflict problem). So I tried to install python3-dev.

Then I tried to install lxml using the same command said earlier and that worked!!!

As I am a newbie in this. So I google searched for those sentences and I could able to understand the meaning of lxml and xslt. I found a link for python-dev but I am not still sure what it is actually doing.

Could anyone help :)


回答1:


python-dev contains the header files you need to build Python extensions. lxml is a Python C-API extension that is compiled when you do pip install lxml. The lxml sources have at least something like #include <Python.h> in the code. The compiler looks for the Python.h file during compilation, hence those files need to be on your system such that they can be found. On Linux typically, the binary libraries and header files of packages like python are separate. Hence you can have Python installed and everything works fine but when you want to build extensions you need to install the corresponding dev package.




回答2:


python-dev is the package that contains the header files for the Python C API, which is used by lxml because it includes Python C extensions for high performance.




回答3:


python-dev contains everything needed to compile python extension modules (https://docs.python.org/2/extending/extending.html).

Note that Debian already has an lxml package for python 3 (mentioned at http://lxml.de/installation.html); in general it's a good idea to use the packaged version. I'd suggest pip uninstall lxml and then apt-get install python3-lxml.




回答4:


http://lxml.de/ will give all information about lxml. & for installing lxml i find https://pypi.python.org/pypi/lxml/3.4.4 it easier than other methods.



来源:https://stackoverflow.com/questions/31002091/what-is-python-dev-package-used-for

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