Last active
June 23, 2021 14:54
-
-
Save bobquest33/7f06763f398175db71bf4033e95489b1 to your computer and use it in GitHub Desktop.
Batch scripts for running mutiple versions of python together in Windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To run these batch scripts, first unzip your python2.7 and python3 binaries ins separate paths as given above. | |
| Save these batch scripts in you root path. | |
| In my case C:\Users\IBM_ADMIN | |
| Then when ever you need to switch python env | |
| from cmd.exe command prompt: | |
| Just do: | |
| envpython2.bat | |
| your env is 2.7 now and pip and all associated libraries and scripts are called from this path C:\Users\IBM_ADMIN\rcs\python-2.7.9. | |
| For python3 | |
| envpython3.bat | |
| your env is 3.6 now and pip and all associated libraries and scripts are called from this path C:\Users\IBM_ADMIN\rcs\Python35-32. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| REM "ftype /?" explains all of this assoc and ftype and PATHEXT usage | |
| REM https://docs.python.org/2/using/windows.html for more info around the subject. | |
| REM set PythonDIR to your python 2 or 3 install path; e.g. the folder with python.exe in it. | |
| set PythonDIR=C:\Users\IBM_ADMIN\rcs\python-2.7.9 | |
| set PATH=%PythonDIR%;%PythonDIR%\Scripts;%PATH% | |
| set PYTHONPATH=%PythonDIR%\Lib;%PythonDIR%\Lib\site-packages;%PythonDIR%\DLLs; | |
| set PATHEXT=%PATHEXT%;.PY;.PYW | |
| assoc .py=Python.File>NUL | |
| assoc .pyw=PythonW.File>NUL | |
| ftype Python.File="%PythonDIR%\python.exe" %%1 %%*>NUL | |
| ftype PythonW.File="%PythonDIR%\pythonw.exe" %%1 %%*>NUL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| REM "ftype /?" explains all of this assoc and ftype and PATHEXT usage | |
| REM https://docs.python.org/2/using/windows.html for more info around the subject. | |
| REM set PythonDIR to your python 2 or 3 install path; e.g. the folder with python.exe in it. | |
| set PythonDIR=C:\Users\IBM_ADMIN\rcs\Python35-32 | |
| set PATH=%PythonDIR%;%PythonDIR%\Scripts;%PATH% | |
| set PYTHONPATH=%PythonDIR%\Lib;%PythonDIR%\Lib\site-packages;%PythonDIR%\DLLs; | |
| set PATHEXT=%PATHEXT%;.PY;.PYW | |
| assoc .py=Python.File>NUL | |
| assoc .pyw=PythonW.File>NUL | |
| ftype Python.File="%PythonDIR%\python.exe" %%1 %%*>NUL | |
| ftype PythonW.File="%PythonDIR%\pythonw.exe" %%1 %%*>NUL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment