To install a new package/module under
WinPython, double-click on WinPython Command Prompt
in
the directory where you installed WinPython to open a command prompt window.
At the command prompt window type pip install pkgname
where pkgname is the name of the package you wish to install. If the
package is already present, you will see the message "requirement already
satisfied." E.g.:
C:\Program Files (x86)\WinPython\scripts>pip install tzlocal Collecting tzlocal Downloading https://files.pythonhosted.org/packages/cb/89/e3687d3ed99bc882793f 82634e9824e62499fdfdc4b1ae39e211c5b05017/tzlocal-1.5.1.tar.gz Collecting pytz (from tzlocal) Downloading https://files.pythonhosted.org/packages/dc/83/15f7833b70d3e067ca91467ca245bae0f6fe56ddc7451aa0dc5606b120f2/pytz-2018.4-py2.py3-none-any.whl (510kB ) 100% |################################| 512kB 1.3MB/s Installing collected packages: pytz, tzlocal Running setup.py install for tzlocal ... done Successfully installed pytz-2018.4 tzlocal-1.5.1 You are using pip version 9.0.3, however version 10.0.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' comm and. C:\Program Files (x86)\WinPython\scripts>pip install pytz Requirement already satisfied: pytz in c:\program files (x86)\winpython\python-3 .5.4\lib\site-packages You are using pip version 9.0.3, however version 10.0.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' comm and. C:\Program Files (x86)\WinPython\scripts>
You can find the installed packages in a
python-x.x.x\Lib\site-packages
directory, where x.x.x
is the Python version number, beneath the one where you installed WinPython.
E.g., I can see the tzlocal, and the pytz package that was installed with it,
on May 18, 2018 in the directory listing below.
C:\Program Files (x86)\WinPython\scripts>dir "C:\Program Files (x86)\WinPython\python-3.5.4\Lib\site-packages" Volume in drive C is OS Volume Serial Number is 4445-F6ED Directory of C:\Program Files (x86)\WinPython\python-3.5.4\Lib\site-packages 05/18/2018 09:13 PM <DIR> . 05/18/2018 09:13 PM <DIR> .. 05/12/2018 09:23 PM <DIR> Brotli-1.0.2.dist-info 04/05/2018 01:08 PM 1,857 brotli.py 05/12/2018 09:23 PM <DIR> cloudpickle 05/12/2018 09:23 PM <DIR> cloudpickle-0.5.2.dist-info 04/05/2018 01:07 PM 6,144 clr.pyd 05/12/2018 09:23 PM <DIR> dask 05/12/2018 09:23 PM <DIR> dask-0.17.2.dist-info 05/12/2018 09:23 PM <DIR> docopt-0.6.2.dist-info 04/05/2018 01:08 PM 19,946 docopt.py 04/05/2018 01:07 PM 126 easy_install.py 05/12/2018 09:23 PM <DIR> idlex-1.13.dist-info 05/12/2018 09:23 PM <DIR> idlexlib 05/12/2018 09:23 PM <DIR> jedi 05/12/2018 09:23 PM <DIR> jedi-0.11.1.dist-info 05/12/2018 09:23 PM <DIR> joblib 05/12/2018 09:23 PM <DIR> joblib-0.11.dist-info 05/12/2018 09:23 PM <DIR> locket 05/12/2018 09:23 PM <DIR> locket-0.2.0.dist-info 05/12/2018 09:23 PM <DIR> parso 05/12/2018 09:23 PM <DIR> parso-0.1.1.dist-info 05/12/2018 09:23 PM <DIR> partd 05/12/2018 09:23 PM <DIR> partd-0.3.8.dist-info 05/12/2018 09:23 PM <DIR> pip 05/12/2018 09:23 PM <DIR> pip-9.0.3.dist-info 05/12/2018 09:23 PM <DIR> pkg_resources 05/12/2018 09:23 PM <DIR> prompt_toolkit 05/12/2018 09:23 PM <DIR> prompt_toolkit-1.0.15.dist-info 05/12/2018 09:23 PM <DIR> ptpython 05/12/2018 09:23 PM <DIR> ptpython-0.41.dist-info 05/12/2018 09:23 PM <DIR> pygments 05/12/2018 09:23 PM <DIR> Pygments-2.2.0.dist-info 05/12/2018 09:23 PM <DIR> pyodbc-4.0.22.dist-info 04/05/2018 01:07 PM 115,712 pyodbc.cp35-win32.pyd 05/12/2018 09:23 PM <DIR> pyreadline 05/12/2018 09:23 PM <DIR> pyreadline-2.0-py3.5.egg-info 04/05/2018 01:07 PM 130,560 Python.Runtime.dll 05/12/2018 09:23 PM <DIR> pythonnet-2.4.0.dev0.dist-info 05/12/2018 09:23 PM <DIR> python_snappy-0.5.2.dist-info 05/18/2018 09:13 PM <DIR> pytz 05/18/2018 09:13 PM <DIR> pytz-2018.4.dist-info 04/05/2018 01:08 PM 2,683 readline.py 04/05/2018 01:06 PM 121 README.txt 05/12/2018 09:23 PM <DIR> setuptools 05/12/2018 09:23 PM <DIR> setuptools-39.0.1.dist-info 05/12/2018 09:23 PM <DIR> six-1.11.0.dist-info 04/05/2018 01:08 PM 30,888 six.py 05/12/2018 09:23 PM <DIR> snappy 05/12/2018 09:23 PM <DIR> sqlite_bro 05/12/2018 09:23 PM <DIR> sqlite_bro-0.8.11.dist-info 05/12/2018 09:23 PM <DIR> test 05/12/2018 09:23 PM <DIR> tlz 05/12/2018 09:23 PM <DIR> toolz 05/12/2018 09:23 PM <DIR> toolz-0.9.0.dist-info 05/18/2018 09:13 PM <DIR> tzlocal 05/18/2018 09:13 PM <DIR> tzlocal-1.5.1-py3.5.egg-info 05/12/2018 09:23 PM <DIR> wcwidth 05/12/2018 09:23 PM <DIR> wcwidth-0.1.7.dist-info 05/12/2018 09:23 PM <DIR> winpython 05/12/2018 09:23 PM <DIR> winpython-1.10.20180404.dist-info 04/05/2018 01:08 PM 778,752 _brotli.cp35-win32.pyd 05/12/2018 09:23 PM <DIR> __pycache__ 10 File(s) 1,086,789 bytes 53 Dir(s) 830,556,725,248 bytes free C:\Program Files (x86)\WinPython\scripts>
If you would like to have the capability to convert Python scripts to
executable .exe files that could be run on other Microsoft Windows systems
without installing WinPython or some other Python implementation for Windows,
you can install PyInstaller to create
an executable file from a Python script with pip install
pyinstaller
.
C:\Program Files (x86)\WinPython\scripts>pip install pyinstaller
Collecting pyinstaller
Downloading https://files.pythonhosted.org/packages/3c/86/909a8c35c5471919b385
4c01f43843d9b5aed0e9948b63e560010f7f3429/PyInstaller-3.3.1.tar.gz (3.5MB)
100% |################################| 3.5MB 277kB/s
Requirement already satisfied: setuptools in c:\program files (x86)\winpython\py
thon-3.5.4\lib\site-packages (from pyinstaller)
Collecting pefile>=2017.8.1 (from pyinstaller)
Downloading https://files.pythonhosted.org/packages/7e/9b/f99171190f04cd237685
47dd34533b4016bd582842f53cd9fe9585a74c74/pefile-2017.11.5.tar.gz (61kB)
100% |################################| 71kB 2.3MB/s
Collecting macholib>=1.8 (from pyinstaller)
Downloading https://files.pythonhosted.org/packages/fd/89/58e160e4c3a010dd85da
b1a43d20d4728be759fbffc1fc78356b344ffe98/macholib-1.9-py2.py3-none-any.whl (40kB
)
100% |################################| 40kB 2.6MB/s
Collecting future (from pyinstaller)
Downloading https://files.pythonhosted.org/packages/00/2b/8d082ddfed935f3608cc
61140df6dcbf0edea1bc3ab52fb6c29ae3e81e85/future-0.16.0.tar.gz (824kB)
100% |################################| 829kB 885kB/s
Collecting pypiwin32 (from pyinstaller)
Downloading https://files.pythonhosted.org/packages/d0/1b/2f292bbd742e369a100c
91faa0483172cd91a1a422a6692055ac920946c5/pypiwin32-223-py3-none-any.whl
Collecting altgraph>=0.15 (from macholib>=1.8->pyinstaller)
Downloading https://files.pythonhosted.org/packages/fe/fd/f63226be4aeebcac65d5
f7e882bd00c8465ce883c1a4d16b18bd4ae9086e/altgraph-0.15-py2.py3-none-any.whl
Collecting pywin32>=223 (from pypiwin32->pyinstaller)
Downloading https://files.pythonhosted.org/packages/32/0f/16419ffd63c60b0c1976
14c430eab35360a94154ac1b846b3ee69f8c8061/pywin32-223-cp35-cp35m-win32.whl (8.3MB
)
100% |################################| 8.3MB 120kB/s
Installing collected packages: future, pefile, altgraph, macholib, pywin32, pypi
win32, pyinstaller
Running setup.py install for future ... done
Running setup.py install for pefile ... done
Running setup.py install for pyinstaller ... done
Successfully installed altgraph-0.15 future-0.16.0 macholib-1.9 pefile-2017.11.5
pyinstaller-3.3.1 pypiwin32-223 pywin32-223
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.
C:\Program Files (x86)\WinPython\scripts>
Once PyInstaller has been installed, you can type pyinstaller --onefile
pythonscript.py
to create a .exe file that you can copy to another
Windows system without needing Python installed on that system (be sure
to include the --onefile
parameter). E.g., in the following
example, I have a Python script, runkey.py, which displays the values within
the
Windows regisry key
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
as well as
the account name for the key and the time the key was last modified, in the
C:\Temp
directory. I created an executable .exe file from that
script by issuing the command pyinstaller --onefile c:\temp\runkey.py
in a WinPython Command Prompt
window.
C:\Temp>pyinstaller --onefile c:\temp\runkey.py 121 INFO: PyInstaller: 3.3.1 121 INFO: Python: 3.5.4 121 INFO: Platform: Windows-10-10.0.16299-SP0 121 INFO: wrote C:\Temp\runkey.spec 121 INFO: UPX is not available. 121 INFO: Extending PYTHONPATH with paths ['c:\\temp', 'C:\\Temp'] 121 INFO: checking Analysis 121 INFO: Building Analysis because out00-Analysis.toc is non existent 121 INFO: Initializing module dependency graph... 121 INFO: Initializing module graph hooks... 121 INFO: Analyzing base_library.zip ... 6215 INFO: running Analysis out00-Analysis.toc 6215 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of f inal executable required by C:\Program Files (x86)\WinPython\python-3.5.4\python.exe 7210 WARNING: lib not found: api-ms-win-core-processthreads-l1-1-0.dll dependenc y of C:\WINDOWS\system32\ucrtbase.dll 7309 WARNING: lib not found: api-ms-win-core-string-l1-1-0.dll dependency of C:\ WINDOWS\system32\ucrtbase.dll 7410 WARNING: lib not found: api-ms-win-core-namedpipe-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll 7557 WARNING: lib not found: api-ms-win-core-console-l1-1-0.dll dependency of C: \WINDOWS\system32\ucrtbase.dll 7658 WARNING: lib not found: api-ms-win-core-processenvironment-l1-1-0.dll depen dency of C:\WINDOWS\system32\ucrtbase.dll 7758 WARNING: lib not found: api-ms-win-core-datetime-l1-1-0.dll dependency of C :\WINDOWS\system32\ucrtbase.dll 7842 WARNING: lib not found: api-ms-win-core-interlocked-l1-1-0.dll dependency o f C:\WINDOWS\system32\ucrtbase.dll 7943 WARNING: lib not found: api-ms-win-core-file-l1-1-0.dll dependency of C:\WI NDOWS\system32\ucrtbase.dll 8027 WARNING: lib not found: api-ms-win-core-sysinfo-l1-1-0.dll dependency of C: \WINDOWS\system32\ucrtbase.dll 8127 WARNING: lib not found: api-ms-win-core-heap-l1-1-0.dll dependency of C:\WI NDOWS\system32\ucrtbase.dll 8212 WARNING: lib not found: api-ms-win-core-util-l1-1-0.dll dependency of C:\WI NDOWS\system32\ucrtbase.dll 8312 WARNING: lib not found: api-ms-win-core-memory-l1-1-0.dll dependency of C:\ WINDOWS\system32\ucrtbase.dll 8428 WARNING: lib not found: api-ms-win-core-libraryloader-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll 8513 WARNING: lib not found: api-ms-win-core-rtlsupport-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll 8613 WARNING: lib not found: api-ms-win-core-debug-l1-1-0.dll dependency of C:\W INDOWS\system32\ucrtbase.dll 8711 WARNING: lib not found: api-ms-win-core-handle-l1-1-0.dll dependency of C:\ WINDOWS\system32\ucrtbase.dll 8813 WARNING: lib not found: api-ms-win-core-profile-l1-1-0.dll dependency of C: \WINDOWS\system32\ucrtbase.dll 8914 WARNING: lib not found: api-ms-win-core-errorhandling-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll 9061 WARNING: lib not found: api-ms-win-core-synch-l1-1-0.dll dependency of C:\W INDOWS\system32\ucrtbase.dll 9177 INFO: Caching module hooks... 9177 INFO: Analyzing c:\temp\runkey.py 9531 INFO: Processing pre-find module path hook distutils 10433 INFO: Loading module hooks... 10433 INFO: Loading module hook "hook-xml.py"... 10819 INFO: Loading module hook "hook-pytz.py"... 10950 INFO: Loading module hook "hook-lib2to3.py"... 10950 INFO: Loading module hook "hook-clr.py"... 10966 INFO: Loading module hook "hook-sysconfig.py"... 10966 INFO: Loading module hook "hook-distutils.py"... 10966 INFO: Loading module hook "hook-encodings.py"... 11098 INFO: Loading module hook "hook-pydoc.py"... 11098 INFO: Loading module hook "hook-pkg_resources.py"... 11900 INFO: Processing pre-safe import module hook win32com 12022 INFO: Loading module hook "hook-pywintypes.py"... 12385 INFO: Loading module hook "hook-pythoncom.py"... 12740 INFO: Loading module hook "hook-win32com.py"... 13326 INFO: Looking for ctypes DLLs 13388 INFO: Analyzing run-time hooks ... 13404 INFO: Including run-time hook 'pyi_rth_pkgres.py' 13404 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py' 13404 INFO: Including run-time hook 'pyi_rth_multiprocessing.py' 13426 INFO: Looking for dynamic libraries 14875 INFO: Looking for eggs 14875 INFO: Using Python library C:\Program Files (x86)\WinPython\python-3.5.4\p ython35.dll 14875 INFO: Found binding redirects: [] 14891 INFO: Warnings written to C:\Temp\build\runkey\warnrunkey.txt 15007 INFO: Graph cross-reference written to C:\Temp\build\runkey\xref-runkey.ht ml 15108 INFO: checking PYZ 15108 INFO: Building PYZ because out00-PYZ.toc is non existent 15108 INFO: Building PYZ (ZlibArchive) C:\Temp\build\runkey\out00-PYZ.pyz 16233 INFO: Building PYZ (ZlibArchive) C:\Temp\build\runkey\out00-PYZ.pyz comple ted successfully. 16248 INFO: checking PKG 16248 INFO: Building PKG because out00-PKG.toc is non existent 16248 INFO: Building PKG (CArchive) out00-PKG.pkg 20138 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully. 20173 INFO: Bootloader C:\Program Files (x86)\WinPython\python-3.5.4\lib\site-pa ckages\PyInstaller\bootloader\Windows-32bit\run.exe 20173 INFO: checking EXE 20173 INFO: Building EXE because out00-EXE.toc is non existent 20173 INFO: Building EXE from out00-EXE.toc 20173 INFO: Appending archive to EXE C:\Temp\dist\runkey.exe 20204 INFO: Building EXE from out00-EXE.toc completed successfully. C:\Temp>
The pyinstaller script created a build
and dist
subdirectory beneath the directory from which I ran the command. Within the
dist
subdirectory was the runkey.exe
file that I
could then copy to another system and run.
C:\Temp>dir dist Volume in drive C is OS Volume Serial Number is 4445-F6ED Directory of C:\Temp\dist 05/18/2018 10:15 PM <DIR> . 05/18/2018 10:15 PM <DIR> .. 05/18/2018 10:15 PM 9,803,933 runkey.exe 1 File(s) 9,803,933 bytes 2 Dir(s) 829,763,534,848 bytes free C:\Temp>
I could also run it from the system on which I created it as shown below.
C:\Temp>dist\runkey Username: Administrator Key last modified: 2018-05-09 00:55:21 Value name: SUPERAntiSpyware Value data: C:\Program Files\Security\SUPERAntiSpyware\SUPERAntiSpyware.exe Value name: GoogleDriveSync Value data: "C:\Program Files (x86)\Google\Drive\googledrivesync.exe" /autostart Value name: Web Companion Value data: C:\Program Files (x86)\Lavasoft\Web Companion\Application\WebCompani on.exe --minimize Value name: OneDrive Value data: "C:\Users\Administrator\AppData\Local\Microsoft\OneDrive\OneDrive.ex e" /background C:\Temp>