我对python, scrapy 和 scrapyd 有点新鲜。我想安装 scrapy 和 scrapyd 。
我使用sudo apt-get install pip
然后尝试安装 scrapyd :pip install scrapyd
我总是得到权限被拒绝错误,这是最后一行日志:
<小时/>
running build_scripts
creating build/scripts-2.7
copying and adjusting bin/scrapyd -> build/scripts-2.7
copying and adjusting bin/scrapyd-deploy -> build/scripts-2.7
changing mode of build/scripts-2.7/scrapyd from 664 to 775
changing mode of build/scripts-2.7/scrapyd-deploy from 664 to 775
running install_lib
creating /usr/local/lib/python2.7/dist-packages/scrapyd
error: could not create '/usr/local/lib/python2.7/dist-packages/scrapyd': Permission denied
-----------------------------------------
Cleaning up...
Removing temporary dir /tmp/pip_build_kamal...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_kamal/scrapyd/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-RZBPsI-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_kamal/scrapyd
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 706, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 697, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_kamal/scrapyd/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-RZBPsI-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_kamal/scrapyd
答案 0 :(得分:0)
安装时你需要使用Sudo。 因此,只需使用sudo再次运行安装即可。
所以它会变成:
sudo pip install scrapyd
答案 1 :(得分:0)
如果您想在系统范围内安装软件包,请使用sudo pip。
sudo pip install scrapyd
否则,安装virtualenv,然后点击。这是更好的做事方式,因为virtualenv允许许多不同的需求版本在一台计算机中共存。
[sudo] pip install virtualenv # do the sudoing once and for all
virtualenv venv # you can change the destination folder 'venv' to another
source venv/bin/activate
pip install scrapyd