How to use libxml2 with python on macOs?

2024/5/20 12:26:32

I'm on OSX Lion and I have libxml2 installed (by default) and I have python installed (by default) but they don't talk to one another. What's the simplest way to make this work on Lion?

$ python -c "import libxml2"
Traceback (most recent call last):File "<string>", line 1, in <module>
ImportError: No module named libxml2
Answer
  1. Visit ftp://xmlsoft.org/libxml2/python/ and ensure this is the latest version
  2. Download it
  3. unpack it
  4. open a term and cd to that directory
  5. type sudo python setup.py install
  6. ls /Library/Python/2.7/site-packages/ and you should see a bunch of libxml2 files
  7. try the test again and it should work

You'll need XCode installed, but like, you should already have that installed, right?

https://en.xdnf.cn/q/73336.html

Related Q&A

SMTP Authentication error while while sending mail from outlook using python language

import smtplibsmtpObj = smtplib.SMTP(smtp.office365.com, 587)smtpObj.ehlo()smtpObj.starttls()smtpObj.login([email protected], abcde)smtpObj.sendmail([email protected], [email protected], Subject: So l…

How do you change environment of Python Interactive on Vscode?

I recently migrated from Spyder to VScode. I created a new conda environment and used setting.json to change the environment in VScode, "python.pythonPath": "/Users/dcai/anaconda3/envs/…

Validate list in marshmallow

currently I am using marshmallow schema to validate the request, and I have this a list and I need to validate the content of it.class PostValidationSchema(Schema):checks = fields.List(fields.String(re…

Save unicode in redis but fetch error

Im using mongodb and redis, redis is my cache.Im caching mongodb objects with redis-py:obj in mongodb: {uname: umatch, usection_title: u\u6d3b\u52a8, utitle: u\u6bd4\u8d5b, usection_id: 1, u_id: Objec…

Authentication with public keys and cx_Oracle using Python

Ive Googled a bit but I havent found any substantial results. Is it possible to use key-based authentication to connect to an Oracle server using Python? My objective is to be able to automate some re…

No luck pip-installing pylint for Python 3

Im interested in running a checker over my Python 3 code to point out possible flaws. PyChecker does not work with Python 3. I tried to pip-install Pylint, but this fails. The error message does not he…

How to use tf.nn.embedding_lookup_sparse in TensorFlow?

We have tried using tf.nn.embedding_lookup and it works. But it needs dense input data and now we need tf.nn.embedding_lookup_sparse for sparse input.I have written the following code but get some erro…

Saving Python SymPy figures with a specific resolution/pixel density

I am wondering if there is a way to change the pixel density/resolution of sympy plots. For example, lets consider the simple code snippet below:import sympy as sypx = syp.Symbol(x) miles_to_km = x * 1…

Matplotlib boxplot width in log scale

I am trying to plot a boxplot with logarithmic x-axis. As you can see on the example below width of each box decreases because of the scale. Is there any way to make the width of all boxes same?

How to enable and disable Intel MKL in numpy Python?

I want to test and compare Numpy matrix multiplication and Eigen decomposition performance with Intel MKL and without Intel MKL. I have installed MKL using pip install mkl (Windows 10 (64-bit), Python …