Lxmlをインストールできません。システムにはpython-lxmlパッケージがありますが、他にも必要です...可能であれば、助けてください-私の仕事は、virtualenvを使用して仮想環境で開発するためにlxmlをインストールすることです。このソリューションは、インストールlxmlを正常に修復しました。
$ Sudo apt-get install libxml2 libxml2-dev libxslt-dev build-essential python-dev
$ Sudo ldconfig
次に:
$ source bin/activate # for activate enviroment
(env) $ pip install lxml
しかし、私には多くの問題があります。
最初の問題は、依存関係を持つビルド必須をインストールすることでした- なぜビルド必須が失敗したのですか?
解決しました!それをありがとう!
次に私はこれを持っています(出力):
(env) $ pip install lxml
...
i686-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-i686-2.7/src/lxml/lxml.etree.o -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-i686-2.7/lxml/etree.so
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: command 'i686-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /tmp/1/bin/python -c "import setuptools, tokenize;__file__='/tmp/1/build/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-DpYhbY-record/install-record.txt --single-version-externally-managed --compile --install-headers /tmp/1/include/site/python2.7 failed with error code 1 in /tmp/1/build/lxml
Storing debug log for failure in /home/constantia/.pip/pip.log
私はこの指示を読みました http://lxml.de/installation.html を試してみてください:
STATIC_DEPS=true pip install lxml
私が試します:
(env) $ STATIC_DEPS=true pip install lxml
...
File "buildlibxml.py", line 268, in call_subprocess
raise Exception('Command "%s" returned code %s' % (cmd_desc, returncode))
Exception: Command "make -j3" returned code 512
----------------------------------------
Cleaning up...
Command python setup.py Egg_info failed with error code 1 in /tmp/1/build/lxml
Traceback (most recent call last):
File "/tmp/1/bin/pip", line 11, in <module>
sys.exit(main())
File "/tmp/1/local/lib/python2.7/site-packages/pip/__init__.py", line 185, in main
return command.main(cmd_args)
File "/tmp/1/local/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 13: ordinal not in range(128)
私は理由がLANG変数かもしれないことを理解し、これを試してください:
$ unset LANG
私が持っている(出力):
(env) $ STATIC_DEPS=true pip install lxml
...
File "buildlibxml.py", line 268, in call_subprocess
raise Exception('Command "%s" returned code %s' % (cmd_desc, returncode))
Exception: Command "make -j3" returned code 512
----------------------------------------
Cleaning up...
Command python setup.py Egg_info failed with error code 1 in /tmp/1/build/lxml
Storing debug log for failure in /home/constantia/.pip/pip.log
だから、STATIC_DEPS = trueでeasy_installを使用しようとします
私が持っている(出力):
(env) $ STATIC_DEPS=true pip install lxml
...
make[2]: *** [progname.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/tmp/easy_install-bqh5aG/lxml-3.3.5/build/tmp/libiconv-1.14/srclib'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/tmp/easy_install-bqh5aG/lxml-3.3.5/build/tmp/libiconv-1.14/srclib'
make: *** [all] Error 2
Traceback (most recent call last):
File "/tmp/1/bin/easy_install", line 11, in <module>
sys.exit(main())
File "/tmp/1/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1909, in main
with_ei_usage(lambda:
File "/tmp/1/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1896, in with_ei_usage
return f()
File "/tmp/1/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1913, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/tmp/1/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 358, in run
self.easy_install(spec, not self.no_deps)
File "/tmp/1/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 593, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/tmp/1/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 623, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/tmp/1/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 809, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/tmp/1/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1015, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/tmp/1/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1000, in run_setup
run_setup(setup_script, args)
File "/tmp/1/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 50, in run_setup
lambda: execfile(
File "/tmp/1/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 100, in run
return func()
File "/tmp/1/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 52, in <lambda>
{'__file__':setup_script, '__name__':'__main__'}
File "setup.py", line 229, in <module>
File "setup.py", line 140, in setup_extra_options
File "/tmp/easy_install-bqh5aG/lxml-3.3.5/setupinfo.py", line 57, in ext_modules
File "/tmp/easy_install-bqh5aG/lxml-3.3.5/buildlibxml.py", line 348, in build_libxml2xslt
File "/tmp/easy_install-bqh5aG/lxml-3.3.5/buildlibxml.py", line 285, in cmmi
File "/tmp/easy_install-bqh5aG/lxml-3.3.5/buildlibxml.py", line 268, in call_subprocess
Exception: Command "make -j3" returned code 512
だから私は悲しいし、何をすべきかわからない。 Stack Exchangeコミュニティからの助けを求めています。
私の質問と英語で申し訳ありません(私の母国語ではありません)。
-lz
は、libz.so
という名前のライブラリファイルを意味します。このファイルは、zlib1g-dev
パッケージによって提供されます。 Sudo apt-get install zlib1g-dev
を実行してパッケージをインストールし、元のコマンドを(STATIC_DEPS
なしで)再試行します。