DEV Community


Posted on • Originally published at on

Setting up python's Windows embeddable distribution (properly)

Embeddable distribution

If there is anything I like about Windows as a pythonist, it must be that you can use embedded distribution of python.

The embedded distribution is a ZIP file containing a minimal Python environment. It is intended for acting as part of another application, rather than being directly accessed by end-users.

In my opinion, it is a portable, ready-to-ship virtualenv. However, the embedded distribution comes with some limitation:

Third-party packages should be installed by the application installer alongside the embedded distribution. Using pip to manage dependencies as for a regular Python installation is not supported with this distribution, though with some care it may be possible to include and use pip for automatic updates. In general, third-party packages should be treated as part of the application (“vendoring”) so that the developer can ensure compatibility with newer versions before providing updates to users.

Sounds scary right? It said it doesn't even support pip. Don't worry, followthese simple steps, you will have a fully workable embedded environment.

Get the distribution

  1. Go to
  2. Choose the version python you like and download the corresponding Windows x86-64 embeddable zip file.
  3. Unzip the file.

To make this tutorial easy to follow, I am assuming that you have downloaded Python3.7 and unzipped it toC:\python\.

Get pip

The distribution does not have pip installed in place, you need to install it yourself:1. Download at Save it to c:\python\get-pip.py3. In command-line run C:\python\python get-pip.py4. pip is now installed

Config path

The runtime of this distribution doesn't have an empty string '' added in sys.path,so that the current directory is not added into sys.path, to solve the problem,you need to:

  1. Open C:\python\python37._pth.
  2. Uncomment the line #import site and save.
  3. Create a new .py file and save it as c:\python\
import sys
sys.path.insert(0, '')
Enter fullscreen mode Exit fullscreen mode

lib2to3 issue

You will encounter the following error when you try to install some packages:

error: [Errno 0] Error: 'lib2to3\\'
Enter fullscreen mode Exit fullscreen mode
  1. Unzip C:\python\ to a new folder
  2. Delete C:\python\
  3. Rename the new folder to (yes, a new folder called

Python's import module is able to treat zip file as folder however, it cannot read pickle file inside a zip file, so unzip it and rename it.

Running pip

If you don't want to mess with you PATH, you can simply do the following in your window command prompt:

  1. CD C:\python\Scripts
  2. pip install xxxxx

Running Scripts

Again if you don't want to mess with you PATH, you can simply do in your window command prompt:

  1. C:\python\python <path to your script>


Top comments (4)

ibitzee profile image

Great info...
I'm fiddling with that 'embbeded' incarnation too... (v 3.8)

Do you know where to change the configuration
(maybe a configuration file... or registry in Windows???)
so that we can extract to a folder ( Lib is an idea ;-) )
(and delete the zip file)
So python will work as usual???

wsakr profile image

just signed up for an account on DEV to like your article .... Thanks for the valuable information

elcordova profile image
Erick L. • Edited

thanks for sharing, awesome post crack!

climentea profile image
Alin Climente

Awesome info!