まず、pip(Mac OS 10.6.8ではPython 2.7.2)を使わずにlxmlをインストールしました。その後、私はthis postを読んで、pip(sudo pip install lxml
)を使って再度インストールしました。私はまだ問題がありました:Macでpythonを使ってlxmlをインストール
lxml(import lxml
)をインポートできますが、from lxml import etree
は使用できません。私はthese instructions次のソースからlxmlのをインストールしようとし、そして
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml-2.3.3-py2.7-macosx-10.6-intel.egg/lxml/etree.so, 2): Symbol not found: _htmlParseChunk
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml-2.3.3-py2.7-macosx-10.6-intel.egg/lxml/etree.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml-2.3.3-py2.7-macosx-10.6-intel.egg/lxml/etree.so
、私はこのエラーメッセージがあります:私はこのエラーメッセージを有する最後
checking whether we are cross compiling... configure: error: in `/Users/my_name/Applications/lxml/lxml-2.2.2/build/tmp/libxml2-2.7.8':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Traceback (most recent call last):
File "setup.py", line 115, in <module>
STATIC_CFLAGS, STATIC_BINARIES),
File "/Users/my_name/Applications/lxml/lxml-2.2.2/setupinfo.py", line 50, in ext_modules
libxslt_version=OPTION_LIBXSLT_VERSION)
File "/Users/my_name/Applications/lxml/lxml-2.2.2/buildlibxml.py", line 198, in build_libxml2xslt
call_subprocess(configure_cmd, cwd=libxml2_dir, **call_setup)
File "/Users/my_name/Applications/lxml/lxml-2.2.2/buildlibxml.py", line 158, in call_subprocess
raise Exception('Command "%s" returned code %s' % (cmd_desc, returncode))
Exception: Command "./configure --without-python --disable-dependency-tracking --disable-shared --prefix=/Users/my_name/Applications/lxml/lxml-2.2.2/build/tmp/libxml2" returned code 1
を、Iはthis answer及びIの第二のアドバイスに従っコマンドラインsudo STATIC_DEPS=true /usr/bin/easy_install-2.7 lxml
を使用しました。 Appleが提供するPython 2.7のシステムにlxmlをインストールしましたが、現在使用しているバージョンではありません。肯定的な点:Apple-Pythonを実行すると、from lxml import etree
とすることができます。
否定的な点:私はまだpythonの別のバージョンにlxmlをインストールする方法がわかりません。何か案が?
私は現在/Library/Frameworks/Python.framework/Versions/2.7/bin/python
を使用しています。
の可能な複製を(のhttp:/ /etc/stackoverflow.com/questions/7961577/need-help-installing-lxml-on-os-x-10-7) – bernie
その質問のOSXのバージョンは違いますが、おそらくそこに行くには十分です – bernie
残念なことに、lxmlをからビルドしますソースは機能しません。 – Antonin