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
sudo python setup.py install
ls /Library/Python/2.7/site-packages/
and you should see a bunch of libxml2 files You'll need XCode installed, but like, you should already have that installed, right?
tkone's answer is OK. But brew also can do it.
Try this,
$ brew install libxml2 --with-python
I don't believe the stock Python ships with the libxml2
module. You can install macports , and then do this:
$ sudo port install py27-libxml2
...and after a short wait while everything installs, end up with Python 2.7, libxml2, and the libxml2 Python module.
只需使用Pypi安装python模块包,输入:
sudo pip search libxml and sudo pip install libxml
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.