Trouble Installing Scrapy on 10.9 Mavericks

回眸只為那壹抹淺笑 提交于 2019-12-04 11:50:02

Here's what worked for me:

  1. Since you're using Homebrew as your package manager, the the programs installed through it will be set to /usr/local/bin rather than the standard /usr/bin path setting for out of the box applications. You'll want to ensure that /usr/local/bin is at the top of the file in /etc/paths. The file should be locked, so you may need to save changes in the vi editor with the following:

    :w !sudo tee %
    
  2. $ which python should return /usr/local/bin/python, else:

    `$ brew unlink python`
    `$ brew install python`
    `$ brew linkapps`
    
  3. $ which pip should return /usr/local/bin/pip, else

    `$ brew install pip`
    
  4. Then...

    `$ sudo pip uninstall Scrapy`
    `$ pip install Scrapy`
    `$ pip install --upgrade Scrapy`
    `$ pip install --upgrade lxml`
    `$ scrapy startproject tutorial`
    
santeko

I had a similar issue installing virtualenv: Can't pip install virtualenv on Mac 10.9 Mavericks with brewed python

the solution there works here as well, although I still do not understand WHY the problem occurred in the first place and why this solution works. But it does.

uninstall and reinstall scrapy:

$pip uninstall scrapy
$pip install scrapy 

This removes modules from /usr/local/lib/python2.7/site-packages and installs them in /usr/local/bin/

The problem is that according to the homebrew python docs, pip is suppose to install in /site-packages and they should work. Not only does it not work with them in /site-packages but pip defaults to installing in /usr/local/bin/.

This workaround works, although I would really appreciate an explanation as to why it works and why this was a problem in the first place. Then perhaps these two questions can be merged?

None of the above worked for me in OS X 10.10 Yosemite.

But I found a solution here.

It's using pkg-config:

brew install pkg-config libffi
export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/
pip install cffi

You will have to change the path according to your libffi version.

You need to give your installation environment access to the Crypto library bundled with OpenSSL. Here is the solution that worked for me.

env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include"

Remember to change this to the location of your updated OpenSSL package.

The other posts didn't work for me, but this did:

sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install scrapy
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!