Installing Python 3 from Source on Linux and Getting Started with the Interpreter

Building Python on Linux

Grab the source tarball from python.org, then configure the build. Specifying --enable-optimizations runs profile-guided optimizations that can improve runtime speed.

./configure --prefix=/usr/local/python3 --enable-optimizations

Compile the interpreter. This step may take several minutes depending on the machine.

make -j$(nproc)

Once compilation finishes, install the binaries and libraries to the prefix directory chosen earlier.

make install

Switching the system python symlink

On many distributions /usr/bin/python points to Python 2.7. Verify the current mapping with ls:

ls -l /usr/bin/python*

Back up the existing symlink, then point it at the freshly built Python 3 executable.

mv /usr/bin/python /usr/bin/python.old
ln -s /usr/local/python3/bin/python3 /usr/bin/python

Check the new default:

python --version

Keeping yum functional

After the change, yum will break because its scripts expect Python 2. Edit the shebang lines of the following files:

/usr/bin/yum
/usr/libexec/urlgrabber-ext-down

Change the first line from #!/usr/bin/python to #!/usr/bin/python2.7. Save and exit. Package management will work normalyl again.

Other Platforms

Windows – Download the installer from python.org. During setup tick Add Python to PATH and follow the prompts.
macOS – Run the official installer package; the workflow mirrors Windows.

Editors and Workflow

An Integrated Development Environment (IDE) bundles a editor, build tools, and a debugger. Popular choices include:

  • VS Code – Lightweight editor with a rich extension ecosystem.
  • PyCharm – Full-featured Python IDE from JetBrains, especially strong for data science stacks (NumPy, Matplotlib).
  • Sublime Text – Fast, cross-platform editor with a minimalist interface.

Using any of these makes writing, testing, and debugging Python far more productive then working directly in the terminal.

Everyday Habits

Comments – Lines starting with # are ignored by the interpreter. Use them to explain non-obvious logic, document function contracts, and leave notes for collaborators.
The Zen of Python – Run import this in any Python shell to read a collection of aphorisms that capture the philosophy of the language.

Tags: python Linux installation ide

Posted on Wed, 30 Sep 2026 16:09:38 +0000 by BRAINDEATH