How to Set Up and Install Python 3 Development Environment Across Platforms
This guide explains how to download, install, and configure Python 3 on Windows, Linux, and macOS, covering binary installers, source compilation, environment‑variable setup, and ways to run Python scripts or use an IDE such as PyCharm, with detailed command examples.
Python 3 Environment Setup
This chapter introduces how to build a local Python 3 development environment, which works on many platforms including Windows, Linux, and macOS.
Downloading Python 3
The latest source code, binaries, and documentation are available on the official Python website https://www.python.org/ . Documentation can be downloaded in HTML, PDF, or PostScript formats from https://www.python.org/doc/ .
Installation
Python has been ported to numerous platforms. For each platform you need the appropriate binary package; if none is available you can compile from source.
Unix & Linux – Example steps for Python 3.6.1:
<code># tar -zxvf Python-3.6.1.tgz
# cd Python-3.6.1
# ./configure
# make && make install</code>Verify the installation with:
<code># python3 -V
Python 3.6.1</code>Windows – Download the executable installer (x86 for 32‑bit, x86‑64 for 64‑bit) from https://www.python.org/downloads/windows/ and check the “Add Python 3.6 to PATH” option.
macOS – macOS ships with Python 2.7; download the latest Python 3.x installer from https://www.python.org/downloads/mac-osx/ or build from source.
Environment Variable Configuration
Programs and executables may reside in directories not included in the system search path. The PATH variable stores these directories.
Unix/Linux – Add Python to PATH :
<code>export PATH="$PATH:/usr/local/bin/python"</code>or for csh :
<code>setenv PATH "$PATH:/usr/local/bin/python"</code>Windows – In a command prompt:
<code>path=%path%;C:\Python</code>Or add the directory via System → Advanced system settings → Environment Variables.
Important Python‑specific variables:
PYTHONPATH – module search path.
PYTHONSTARTUP – script executed on interpreter start.
PYTHONCASEOK – makes imports case‑insensitive.
PYTHONHOME – alternative module search location.
Running Python
Three common ways:
Interactive interpreter: python (Unix) or python (Windows).
Command‑line script: python script.py .
IDE: PyCharm – a full‑featured Python IDE (download from https://www.jetbrains.com/pycharm/download/ ).
Python command‑line options include -d (debug), -O (optimise), -S (skip site‑module), -V (version), -c cmd (execute command), and specifying a script file.
Additional Resources
The article also provides QR‑code links for a free Python public course and further reading on popular Python libraries, learning roadmaps, and books.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.