I have a hell of a scrapy installation time on my sl mbp. it requires libxml2, so I decided to install this. installing it from macports does not seem to reset the python binding.
installing it from the source using scrapy instructions ( here ) sets the python bindings, but when I run python -c, import libxml2 "I get an architecture mismatch:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "libxml2.py", line 1, in <module>
import libxml2mod
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site- packages/libxml2mod.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site- packages/libxml2mod.so: mach-o, but wrong architecture
when I explicitly create the libxml2 dll as 32-bit, this error goes away, but then libxslt will not build due to the fact that some other library will not be 32-bit. I'm afraid to keep pulling this line. so the question is only python 32bit? am i doing something stupid here?
edit is python 2.6
edit 2 - by popular request, I am consolidating @Ned Deily amazing answer here. all to him on credit, I just publish the steps that I took based on his answer:
if you trick mac ports (and didn't install anything else through them that you need), nuke them.
$ sudo rm -r /opt/local
add the following to /opt/local/etc/macports/variants.confto prevent the entire unix library from loading with the following commands
+bash_completion +quartz +ssl +no_x11 +no_neon +no_tkinter +universal +libyaml -scientific
install macports python version
$ sudo port install python26
set prerequisites for <
sudo port install py26-libxml2 py26-twisted py26-openssl py26-simplejson py26-setuptools python_select
sudo python_select python26
check that the correct python is selected: run it $ which python, which should say something in the lines '/ opt / local / bin / python', and that at its discretion there should be a link to / opt / local / bin / python 2.6.
, : file 'which python' ( , ( Intel, 10.6):
/opt/local/bin/python2.6: Mach-O universal binary with 2 architectures
/opt/local/bin/python2.6 (for architecture x86_64): Mach-O 64-bit executable x86_64
/opt/local/bin/python2.6 (for architecture i386): Mach-O executable i386
, libxml
$ python -c 'import libxml2'
, .
scrapy
sudo /opt/local/bin/easy_install-2.6 scrapy
( ), , . , .