{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Installing and Running Python\n",
        "\n**Opening question:** What is the least fragile way to move from “I have a computer” to a working, reproducible Python environment?\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "import platform\n",
        "import sys\n",
        "\n",
        "print(sys.version.split()[0])\n",
        "print(sys.executable)\n",
        "print(platform.system())\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "**Interpretation check:** Interpretation. Your path will differ. The important point is that the notebook and the environment should refer to the same interpreter.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "from pathlib import Path\n",
        "\n",
        "project = Path.cwd()\n",
        "data_dir = project / \"data\" / \"frozen\"\n",
        "print(data_dir.relative_to(project).as_posix())\n",
        "print(data_dir.exists())\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "**Interpretation check:** Interpretation. pathlib joins folders without hard-coded slashes and makes the intended location explicit.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "import platform\n",
        "import sys\n",
        "print(sys.version.split()[0])\n",
        "print(sys.executable)\n",
        "print(platform.system())\n",
        "from pathlib import Path\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Verified source output\n",
        "\n",
        "```text\n3.13.5 /opt/pyvenv/bin/python Linux\n```\n\n```text\ndata/frozen True\n```\n\n```text\n3.13.5\n/opt/pyvenv/bin/python\nLinux\n```\n\n```text\ndata/frozen\nTrue\n```\n"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "name": "python",
      "version": "3"
    },
    "ceteris_lab": {
      "course_slug": "fundamentals-python-econometrics",
      "source_derived": true,
      "course_title": "Fundamentals of Python for Financial Econometrics",
      "chapter": 2,
      "source_origin": "source-derived"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}
