Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Python using the "embeddable zip file"

Tags:

python

pycharm

I downloaded the Windows x86-64 embeddable zip file from https://www.python.org/downloads/release/python-365/.

(I cannot use the executable/web-based installer on my computer)

I want to install this on my PyCharm. How do I achieve this?

like image 499
Jun Jang Avatar asked Jun 12 '18 13:06

Jun Jang


People also ask

What is Python embeddable ZIP file?

The embeddable package. New in version 3.5. 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.


1 Answers

There are 2 main steps (each with its own set of substeps) that need to be followed:

  1. Download and unpack the interpreter on your machine:

    1. Download the .zip file (e.g. [Python]: python-3.6.5-embed-amd64.zip) on your computer, in an empty dir (on my machine it's: "e:\Work\Dev\StackOverflow\q050818078\python36x64")
    2. Unzip the file (some (.pyd, .dll, .exe, .zip, ._pth) files will appear). At the end, you can delete the .zip file that you downloaded in previous step
  2. Configure PyCharm to use it:

    Notes:

    • In order for the images below to be a small as possible (from size and display PoV), I have reduced the sizes of all windows from their default values
    • Some PyCharm stuff is specific to my machine / environment, (obviously) that will be different in your case
    • The script that I used for testing, is a dummy one that just prints some paths (that's why I didn't add it as code, it's just in the 1st image)
    • I only illustrate the minimal required steps to get you going, so even if for some steps there are options to customize them, I'm not going to mention them
    • I am using PyCharm Community Edition 2017.3.3 (in other versions things could be slightly different)

    Steps:

    1. In PyCharm main window (considering your project is open), go to menu "File -> Settings...":

      enter image description here

      You could also go to "File -> Default Settings...", check [JetBrains]: Project and IDE Settings for differences between them.

    2. In the "Settings" window, click "Project Interpreter -> Show All" (you might need to scroll down - if you have multiple interpreters configured)

      enter image description here

    3. In the "Project Interpreters" window, click the "Add" button (green + on upper right side). Also, you might have to click an "Add Local..." control that appears when you click "Add"

      enter image description here

    4. In the "Add Local Python Interpreter", make sure to:

      • Check "Exiting environment" radio button
      • Click the "..." ("Browse") button

      enter image description here

    5. In the "Select Python Interpreter" window, go to the folder where you unzipped the file at #1.1., select python.exe and then click "OK"

      enter image description here

    6. Click the "OK" button in all the windows opened at previous steps (in reversed order), until you're back to main window

In order to test, on the code editor window, right click and from the popup menu choose "Run 'code'". Here's console output window content:

E:\Work\Dev\StackOverflow\q050818078\python36x64\python.exe E:/Work/Dev/StackOverflow/q050818078/src/code.py
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32

E:\Work\Dev\StackOverflow\q050818078\python36x64\python.exe
E:\Work\Dev\StackOverflow\q050818078\src\code.py

Process finished with exit code 0

As a final note, naming the test file code.py was "a bit" uninspired, as there is such a module in Python's standard library (in the meantime, I renamed it to code00.py), but I don't feel like doing all the screenshots (that contain it) again.

like image 108
CristiFati Avatar answered Oct 14 '22 08:10

CristiFati