2014-10-10 24 views
6

Đây là lệnh tôi dùng để cài đặt lxml:Fail để cài đặt lxml sử dụng pip

sudo pip install lxml 

Và tôi đã được thông báo sau trong giai đoạn làm sạch Up:

Cleaning up... 
Command /usr/bin/python -c "import setuptools,  tokenize;__file__='/private/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-rUFjFN-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/lxml 
Storing debug log for failure in /Users/georgejor/Library/Logs/pip.log 

Sau đó, tôi nhận được :

ImportError: No module named lxml 

Vui lòng trợ giúp. Cảm ơn!

Sản lượng sau đây là từ pip.log:

---------------------------------------- 
Cleaning up... 
    Removing temporary dir /private/tmp/pip_build_root... 
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-rUFjFN-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/lxml 
Exception information: 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 122, in main 
    status = self.run(options, args) 
    File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 283, in run 
    requirement_set.install(install_options, global_options, root=options.root_path) 
    File "/Library/Python/2.7/site-packages/pip/req.py", line 1435, in install 
    requirement.install(install_options, global_options, *args, **kwargs) 
    File "/Library/Python/2.7/site-packages/pip/req.py", line 706, in install 
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False) 
    File "/Library/Python/2.7/site-packages/pip/util.py", line 697, in call_subprocess 
    % (command_desc, proc.returncode, cwd)) 
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-rUFjFN-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/lxml 
+0

Điều này có nghĩa rằng 'lxml' không được cài đặt đúng cách. Thực hiện điều này 'cat/Users/georgejor/Library/Logs/pip.log' và hiển thị cho chúng tôi trong câu hỏi. –

+0

Ok tôi vừa mới thêm. Hy vọng nó có thể giúp đỡ. –

+0

Có vẻ như bạn chưa cài đặt công cụ cài đặt. Cài đặt setuptools bằng cách sử dụng 'pip install setuptools' –

Trả lời

0

lxml có C depenedencies, thường tôi chạy vào các vấn đề khi tôi đang thiếu libxslt hoặc libxml2. Bạn có chắc chắn rằng tất cả các phụ thuộc không python được cài đặt?

+0

Tôi đang sử dụng Linux, cố cài đặt llvmlite và điều này không có tác dụng đối với tôi – gota

11

Chỉ cần cài đặt những thứ:

sudo apt-get install libxml2-dev libxslt-dev python-dev python-setuptools 

Sau đó thử lại:

pip install lxml 
+0

điều này có tác dụng đối với tôi. Mặc dù sao chép một cách mù quáng các chương trình khác nhau để cài đặt Tôi không có ý tưởng về được biết đến không phải là một ý tưởng tốt nhưng nó đã làm việc :-) – Martin

Các vấn đề liên quan