Installing a Python on Windows 11 requires a bunch of dependencies from Linux and some functions might not work if not properly installed. That is why a portable Python that works 100% is ideal for installing on the Windows environment.
What’s good news is Python has its own embedded version that can be use as a third party module for other programs that doesn’t require any dependency. Installing a module using pip is also possible with our step by step guide.
Download Python Embedded
The latest version of embedded python is currently at version 3.11.4. You can download the embedded version below:
- Python 3.11.4 Embedded (10.3 MB): https://www.python.org/ftp/python/3.11.4/python-3.11.4-embed-amd64.zip
How to Install it on Windows
To install it on your windows system, you just have to extract it on the folder that you want. For example, we extracted the files at C:\python3
From here you can now use the python, but if you want the python available on CMD command when you call it. We can just add it on the system environment variables.
Search in Cortana “Environment Variables“. Then open it.
Click the Environment Variables at the bottom of Advanced tab.
Now, at the System variables. Find the variable Path and click Edit….
Then click Browse.. then find the folder of the Python directory you just extracted. In our example, its C:\python3. Then hit OK to all windows.
After that, open up a terminal and you can now call python straight from the command prompt.
Let’s try some hello python program. Create a file called helloworld.py, then add the following codes.
To run the file, open up terminal, go to the directory and call.
How to Install Pip on Python
Installing pip in your embedded python is easy. First, you just have to edit the python39._pth file inside your python directory. Then add
Lib/site-packages on the top, then uncomment the
Lib/site-packages python39.zip . # Uncomment to run site.main() automatically import site
After that, open up Terminal or CMD. Then browse to your python directory. Since in our example, our python directory is C:\python3, the command should look like:
cd /d C:\python3
Once you’re inside the directory, we can now install the pip.
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py
Wait until the download completes and installs the required files. After that, pip is now installed in your system.
To use pip, just use the following command in the terminal. You can find other module at https://pypi.org/
python -m pip install THE_MODULE_NAME
Troubleshoot PIP install
In some cases, you’ll receive an error message when trying to install some modules that says “Preparing wheel metadata … error”. There are ways to fix it by installing the WHL package of the module.
For example, when you install numpy. Some popular WHL file package are available at https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
For Windows 10, download numpy‑1.19.0rc2+mkl‑cp39‑cp39‑win_amd64.whl
Then on the command prompt, to install it, just fire the following command.
python -m pip install numpy-1.19.0rc1+mkl-cp39-cp39-win_amd64.whl
That’s it guys!