我在Amazon EC2中安装lxml
时遇到问题。我有一个Linux实例。我输入了以下命令。
sudo pip install lxml
现在,它无法正常工作。它只会产生以下错误。
[root@ip-10-252-54-226 ec2-user]# sudo pip install lxml
Downloading/unpacking lxml
Downloading lxml-3.2.5.tar.gz (3.3MB): 3.3MB downloaded
Running setup.py (path:/tmp/pip_build_root/lxml/setup.py) egg_info for package lxml
/usr/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
/usr/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'zip_safe'
warnings.warn(msg)
Building lxml version 3.2.5.
Building without Cython.
Using build configuration of libxslt 1.1.26
Building against libxml2/libxslt in the following directory: /usr/lib
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: invalid command 'egg_info'
Complete output from command python setup.py egg_info:
/usr/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
/usr/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'zip_safe'
warnings.warn(msg)
Building lxml version 3.2.5.
Building without Cython.
Using build configuration of libxslt 1.1.26
Building against libxml2/libxslt in the following directory: /usr/lib
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: invalid command 'egg_info'
这里有什么问题?我该如何安装?
更新
我使用了pip install --upgrade setuptools
。现在我得到了以下内容。
[ec2-user@ip-10-252-54-226 ~]$ pip install --upgrade setuptools
Downloading/unpacking setuptools from https://pypi.python.org/packages/3.4/s/setuptools/setuptools-2.1-py2.py3-none-any.whl#md5=be57ff5b99882a20f5987cacc0e72893
Downloading setuptools-2.1-py2.py3-none-any.whl (540kB): 540kB downloaded
Installing collected packages: setuptools
Found existing installation: setuptools 0.6c11
Uninstalling setuptools:
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/pip-1.5-py2.6.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.6/site-packages/pip-1.5-py2.6.egg/pip/commands/install.py", line 275, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python2.6/site-packages/pip-1.5-py2.6.egg/pip/req.py", line 1367, in install
requirement.uninstall(auto_confirm=True)
File "/usr/lib/python2.6/site-packages/pip-1.5-py2.6.egg/pip/req.py", line 585, in uninstall
paths_to_remove.remove(auto_confirm)
File "/usr/lib/python2.6/site-packages/pip-1.5-py2.6.egg/pip/req.py", line 1768, in remove
renames(path, new_path)
File "/usr/lib/python2.6/site-packages/pip-1.5-py2.6.egg/pip/util.py", line 294, in renames
shutil.move(old, new)
File "/usr/lib/python2.6/shutil.py", line 261, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info'
Storing debug log for failure in /home/ec2-user/.pip/pip.log
答案 0 :(得分:2)
您正在升级系统范围的库。程序包管理器需要更多访问权限才能执行此操作。
使用:
sudo pip install --upgrade setuptools