Guest User

Untitled

a guest
Jan 19th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. ## Windows 32-bit Python side-by-side 64-bit Python
  2.  
  3. Typically on Windows you will install the 64-bit version of Python, however
  4. this presents a challenge when building binaries with cx_Freeze since it will
  5. use this 64-bit version of Python exclusively. To generate a 32-bit binary you
  6. will need to install a 32-bit version of Python side-by-side the 64-bit version.
  7. Unfortunately this is a tricky process but it can be simplified using the
  8. virtualenv tool.
  9.  
  10. The steps below outline a general process for installing 64-bit Python as the
  11. main Python interpretor and using a 32-bit Python virtualenv side-by-side to
  12. build 32-bit executables with cx_Freeze.
  13.  
  14. First install Python 2.7 **x64** in its normal C:\Python27 location.
  15.  
  16. Next install Python 2.7 **x86** but override the location to be something unique
  17. like C:\Python27-x86. Also you **must** set the register extensions option in the
  18. installer to disabled/not installed (this will prevent the 32-bit version taking
  19. over the default path, etc.).
  20.  
  21. Now open a command window and navigate to the path that Python 32bit was installed
  22. and run the `scripts/pip.exe` to install virtualenv in 32bit python:
  23. ```
  24. c:\Python27-x86\Scripts\pip.exe install virtualenv
  25. ```
  26.  
  27. To create a virtualenv use the virtualenv.exe (also installed in the Scripts folder)
  28. like normal. For example to create a new virtual environment called py32 open a
  29. terminal in your home directory and run:
  30. ```
  31. c:\Python27-x86\Scripts\virtualenv.exe py32
  32. ```
  33.  
  34. The created virtualenv will have a Scripts subdirectory with an activate.bat. When
  35. this bat file is run it will setup the environment to use Python 32-bit. For example
  36. from your home directory run in a command terminal:
  37. ```
  38. .\py32\Scripts\activate.bat
  39. ```
  40.  
  41. Now Python, pip, etc. should all be using the 32-bit Python virtual environment.
  42. You can build software with cx_Freeze etc and it will use this 32-bit version
  43. of Python.
Add Comment
Please, Sign In to add comment