2014-08-29 20 views
12

Sto cercando di installare Scrapy con easy_install -U Scrapy ma finisce in uno strano errore "Impossibile aprire il file include" durante il tentativo di installarlo. Qualcuno sa cosa sta succedendo? Ecco il mio traceback completo:Installazione scrapy Errore con 'impossibile aprire' include: '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 

risposta

29

Ho ricevuto lo stesso errore durante l'installazione di diverse app Python. Mi mancava il pacchetto dev OpenSSL, risolto da:

sudo apt-get install libssl-dev 
+0

Questa risposta ha funzionato per me. –

10

su OSX

brew install openssl e poi eventualmente brew link openssl --force se si viene informati che i collegamenti non sono stati creati.

Installare Scrapy utilizzando il seguente comando

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

È possibile, se lo si desidera, sostituire openssl per libressl.

+0

'brew link openssl --force' ha aggiunto il link simbolico appropriato in'/usr/local/include' che ha risolto il problema per me. –

+0

'brew links openssl --force' ha funzionato anche per me. Dopodiché, 'pip installa scrapy' ha funzionato fino al completamento. –

2

E 'sufficiente installare OpenSSL

brew install openssl 

ed esportare

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

in ~/.bash_profile. Cercare di evitare il collegamento con il parametro --force perché può causare conflitti con le librerie di sistema.

+0

La domanda di asker in questione era ingiustamente parlando di Windows, grazie Pavel come utente OSX questo era il nudge di cui avevo bisogno. –

Problemi correlati