我正在尝试在运行Yosemite的Macbook Pro上安装Scrapy。我尝试通过在终端中运行以下命令来关注其网站上的文档以进行灌输。
pip install Scrapy
在灌输期间,抛出以下异常:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.5.6 py2.7.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/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-1.5.6-py2.7.egg/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 215, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 205, in clobber
os.makedirs(destdir)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/scrapy'
有关如何进行的任何想法?
答案 0 :(得分:5)
尝试使用:
sudo easy_install Scrapy
它对我有用(MacOS El Capitan)。
答案 1 :(得分:3)
无法为Scrapy安装lxml preq ,我想出来了,这就是
我在安装Scrapy的先决条件时遇到了麻烦。特别是lxml库阻止了Scrapy的安装。我最终弄明白了。
我正在运行mac OSX Yosemite 10.10.1
以下是命令
UserNames-MacBook:~username $ sudo env ARCHFLAGS = -Wno-error = unused-command-line-argument-hard-error-in-future STATIC_DEPS = true pip install lxml
//结果 - 已成功安装lxml-3.4.2
UserNames-MacBook:~username $ sudo easy_install Scrapy
//结果 - 已安装/Library/Python/2.7/site-packages/w3lib-1.11.0-py2.7.egg 完成了Scrapy的处理依赖性
//检查Scrapy是否安装正确 UserNames-MacBook:~username $ scrapy --version
//结果 - Scrapy 0.24.5 - 没有活动项目
答案 2 :(得分:1)
试试这个:
sudo pip install Scrapy
如果这也行不通,那就试试这个:
sudo apt-get install python-scrapy
答案 3 :(得分:0)
尝试忽略已安装的依赖项:
pip install Scrapy --ignore-installed