简体   繁体   中英

How do I install PyOpenSSL on Windows 7 64-bit?

To get Scrapy working on HTTPS, I need PyOpenSSL , but I can't seem to get this to work.

So, is there a 64-bit version available? I don't see one... I have installed the 32-bit version but...

I currently get this error back from Scrapy:

ERROR: Error downloading <https://SOME_PRIVATE_URL_HERE>:  
  [Failure instance: Traceback: <class 'scrapy.exceptions.NotSupported'>:
  HTTPS not supported: install pyopenssl library

Does anyone have a clue how to obtain or compile a 64-bit version? Or is that unneccesary?

Actually, step 9 at this website will resolve your issue.

http://steamforge.net/wiki/index.php/How_to_Install_Scrapy_in_64-bit_Windows_7

EDIT: Including the content from steamforge:

Notes

  • Scrapy must be installed with Python 2.5, 2.6, or 2.7 (NOT 3.x)
  • Python 2.7 (and 3.2) do not load the correct 32-bit compatible Windows Registry Keys

Install Procedure

  1. Download & install Python 2.7.2 (using the Windows Installer) from http://www.python.org/getit/
  2. Go to the Search programs and files bar at the bottom of the start menu and type “regedit” and hit enter
  3. Using the left pane navigate to “HKEY_LOCAL_MACHINE\\SOFTWARE\\Python” & click on it (highlighting it in blue)

    1. With the branch selected go to File --> Export
    2. Save the file somewhere you can get to it easily
    3. Open the file in your favorite text editor
    4. Insert "\\Wow6432Node" inbetween “SOFTWARE” and "\\Python" on every line (an easy way to do this is to do a find and replace with “SOFTWARE” in the Find Field and “SOFTWARE\\Wow6432Node” in the Replace Field
    5. Save the file
    6. Navigate to where you saved said file and double click on it to initiate a Registry Modification
  4. Now download the Scrapy 0.14 Windows installer from http://pypi.python.org/pypi/Scrapy

  5. Double click the Scrapy Installer and everything should work fine.
  6. Download and install Twisted 11.1.0 for Python 2.7 64 bit from http://twistedmatrix.com/trac/wiki/Downloads
  7. Download and install Zope.Interface

    1. Download distribute_setup.py from http://python-distribute.org/distribute_setup.py (right click & save), then double click it to install
    2. Download zope.interface-3.8.0-py2.6-win-amd64.egg from http://pypi.python.org/pypi/zope.interface/3.8.0#downloads
    3. Open a command prompt (type “cmd” into the same Search programs and files pane as above) and navigate to your Python Scripts folder (something like “cd C:\\Python27\\Scripts”)
    4. type “easy_install C:\\Downloads\\zope.interface-3.8.0-py2.6-win-amd64.egg” (replacing C:\\Downloads\\ with wherever you downloaded Zope.Interface to) and hit enter
  8. Download and install lxml-2.3.2.win-amd64-py2.7.‌exe from http://www.lfd.uci.edu/~gohlke/pythonlibs/

  9. Download and install egenix-pyopenssl-0.13.0_1.0.0g_1.win-amd64-py2.7.msi from http://www.egenix.com/cryptodownload/?file=egenix-pyopenssl-0.13.0_1.0.0g_1.win-amd64-py2.7.msi

    • When it asks you to navigate to a Python 2.6 Directory, just point it to your Python 2.7 Directory (C:\\Python27 by default)
  10. Install w3lib

    1. Open a command prompt (Start -> Search programs and files -> “cmd”)
    2. Navigate to your Python Scripts Folder (nominally “C:\\Python27\\Scripts”)
    3. Type “easy_install w3lib” and hit enter
  11. Now we just need to add the Python Scripts folder to the System Path so we can use scrapy

    1. Click the “Start Menu” button and Right Click on “Computer” and select “Properties”
    2. Click “Advanced system settings” in the left bar
    3. Click “Environment Variables...”
    4. Find the “Path” variable in the (lower) System variables Pane and double click on it
    5. Click in the “Variable value:” pane and hit the “End” button
    6. Type, or paste, ";C:\\Python27\\Scripts\\" (modify for wherever you installed Python) at the end of the line
    7. *Be sure not to disturb or change any of the existing information there
    8. Hit OK, OK,OK, X

Your problem is that PyOpenSSL is not installed. You don't say, but I infer from your question that you have installed a 32 bit version of PyOpenSSL but are using a 64 bit version of Python. That won't work.

If you really can't get a 64 bit version of PyOpenSSL, then the simplest, and possibly the only, solution will be to install 32 bit versions of Python, Scrapy and all its dependencies. If you are feeling brave then you could attempt to compile from source for 64 bit but I don't know enough about PyOpenSSL to say whether or not that's practical.

eGenix.com provides Windows 32-bit and 64-bit installers. I just downloaded and installed the Windows 64-bit installer for Python 2.6 and it resolved my issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM