PyopenSSL and scrapy install fails in Python 27, W

2019-06-14 14:49发布

问题:

My package install (using PIP & Easyinstall) fails every time when I install PyopenSSL and Scrapy on Python 2.7. OS: Win 8.1 64 Bit.

The error details are below:

C:\Users\<Username>\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\python27\include -Ic:\python27\PC /Tcbuild\temp.win-amd64-2.7\Release_openssl.c /Fobuild\temp.win-amd64-2.7\Release\build\temp.win-amd64-2.7\Release_openssl.obj _openssl.c
build\temp.win-amd64-2.7\Release_openssl.c(429) : fatal error C1083: Cannot open include file: 'openssl/opensslv.h': No such file or directory error: command 'C:\Users\Suraj\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe' failed with exit status 2

Exception information:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\pip\basecommand.py", line 211, in main
status = self.run(options, args)
File "c:\python27\lib\site-packages\pip\commands\install.py", line 311, in run
root=options.root_path,
File "c:\python27\lib\site-packages\pip\req\req_set.py", line 646, in install Kwargs
File "c:\python27\lib\site-packages\pip\req\req_install.py", line 852, in install
show_stdout=False,
File "c:\python27\lib\site-packages\pip\utils\__init__.py", line 733, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command "c:\python27\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\suraj\\appdata\\local\\temp\\pip-build-ajzmpr\\cryptography\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\suraj\appdata\local\temp\pip-kppgmc-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\suraj\appdata\local\temp\pip-build-ajzmpr\cryptography.

Troubleshooting done so far:

1.The error is same with Easyinstall and Pip
2. Changed the logs to Verbose levels.
3.Checked multiple Stackoverflow links, still no luck:
http://stackoverflow.com/questions/37951303/fatal-error-c1083-cannot-open-include-file-openssl-opensslv-h

Installed programs on Windows

Microsoft Visual C++ 2012 Redistributable (x86) - 11.0.61030 Microsoft Corporation 07/10/2014 17.3 MB 11.0.61030.0

Microsoft Visual C++ Compiler Package for Python 2.7 Microsoft Corporation 26/07/2016 380 MB 9.0.1.30729

Thanks in advance

回答1:

I was having the same issue. Here is what i did:

Install Cryptography first on your computer, using the following link: https://cryptography.io/en/latest/installation/#on-windows

if you don't have openSSL installed on your computer the above page will have the link for that. Add the environment variables as mentioned in the link and try to install it again.