2014-08-29 4 views
12

Próbuję zainstalować Scrapy z easy_install -U Scrapy, ale kończy się dziwnym błędem "Can not open include file" podczas próby instalacji. Czy ktoś wie, co się dzieje? Oto mój pełny traceback:Instalacja Scrapy Fails z błędem "nie można otworzyć to:" openssl/aes.h '

C:\Users\Mubashar Kamran>easy_install -U Scrapy 
Searching for Scrapy 
Reading https://pypi.python.org/simple/Scrapy/ 
Best match: scrapy 0.24.4 
Processing scrapy-0.24.4-py2.7.egg 
scrapy 0.24.4 is already the active version in easy-install.pth 
Installing scrapy-script.py script to C:\Python27\Scripts 
Installing scrapy.exe script to C:\Python27\Scripts 
Installing scrapy.exe.manifest script to C:\Python27\Scripts 

Using c:\python27\lib\site-packages\scrapy-0.24.4-py2.7.egg 
Processing dependencies for Scrapy 
Searching for cryptography>=0.2.1 
Reading https://pypi.python.org/simple/cryptography/ 
Best match: cryptography 0.5.4 
Downloading https://pypi.python.org/packages/source/c/cryptography/cryptography- 
0.5.4.tar.gz#md5=4fd1f10e9f99009a44667fabe7980aec 
Processing cryptography-0.5.4.tar.gz 
Writing c:\users\mubash~1\appdata\local\temp\easy_install-jjms3i\cryptography-0. 
5.4\setup.cfg 
Running cryptography-0.5.4\setup.py -q bdist_egg --dist-dir c:\users\mubash~1\ap 
pdata\local\temp\easy_install-jjms3i\cryptography-0.5.4\egg-dist-tmp-ry6bwd 
C:\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 
'setup_requires' 
    warnings.warn(msg) 
_Cryptography_cffi_684bb40axf342507b.c 
    Creating library c:\users\mubash~1\appdata\local\temp\easy_install-jjms3i\cry 
ptography-0.5.4\cryptography\hazmat\primitives\__pycache__\Release\cryptography\ 
hazmat\primitives\__pycache__\_Cryptography_cffi_684bb40axf342507b.lib and objec 
t c:\users\mubash~1\appdata\local\temp\easy_install-jjms3i\cryptography-0.5.4\cr 
yptography\hazmat\primitives\__pycache__\Release\cryptography\hazmat\primitives\ 
__pycache__\_Cryptography_cffi_684bb40axf342507b.exp 
_Cryptography_cffi_8f86901cxc1767c5a.c 
    Creating library c:\users\mubash~1\appdata\local\temp\easy_install-jjms3i\cry 
ptography-0.5.4\cryptography\hazmat\primitives\__pycache__\Release\cryptography\ 
hazmat\primitives\__pycache__\_Cryptography_cffi_8f86901cxc1767c5a.lib and objec 
t c:\users\mubash~1\appdata\local\temp\easy_install-jjms3i\cryptography-0.5.4\cr 
yptography\hazmat\primitives\__pycache__\Release\cryptography\hazmat\primitives\ 
__pycache__\_Cryptography_cffi_8f86901cxc1767c5a.exp 
_Cryptography_cffi_4ed9e37dx4000d087.c 
cryptography\hazmat\bindings\__pycache__\_Cryptography_cffi_4ed9e37dx4000d087.c(
194) : fatal error C1083: Cannot open include file: 'openssl/aes.h': No such fil 
e or directory 
error: c:\users\mubash~1\appdata\local\temp\easy_install-jjms3i\cryptography-0.5 
.4\cryptography\hazmat\primitives\__pycache__\_Cryptography_cffi_684bb40axf34250 
7b.pyd: Access is denied 

Odpowiedz

29

Mam ten sam błąd podczas instalacji innej aplikacji Pythona. Brakowało mi pakiet OpenSSL dev, rozwiązany przez:

sudo apt-get install libssl-dev 
+0

Ta odpowiedź zadziałała. –

10

Na OSX

brew install openssl a następnie ewentualnie brew link openssl --force jeśli są informowani, że linki nie zostały stworzone.

Install Scrapy pomocą następującego polecenia

env CRYPTOGRAPHY_OSX_NO_LINK_FLAGS=1 LDFLAGS="$(brew --prefix openssl)/lib/libssl.a $(brew --prefix openssl)/lib/libcrypto.a" CFLAGS="-I$(brew --prefix openssl)/include" pip install scrapy

Można, jeśli chcesz, aby zastąpić openssllibressl.

+0

'brew link openssl --force' dodał odpowiednie łącze symboliczne w'/usr/local/include', które naprawiło problem dla mnie. –

+0

'brew links openssl --force' pracował także dla mnie. Następnie zakończyło się 'pip install scrapy'. –

2

Wystarczy zainstalować OpenSSL

brew install openssl 

i eksportować

export LDFLAGS=-L/usr/local/opt/openssl/lib 
export CPPFLAGS=-I/usr/local/opt/openssl/include 

w ~/.bash_profile. Staraj się unikać łączenia z opcją --force, ponieważ może to prowadzić do konfliktów z bibliotekami systemowymi.

+0

Udzielono pytającego pytanie, mówiąc o oknach, dziękuję, że Pavel jako użytkownik OSX był tym, czego potrzebowałem. –

Powiązane problemy