Skip to content

Instantly share code, notes, and snippets.

@automagictv
Last active September 27, 2022 02:36
Show Gist options
  • Select an option

  • Save automagictv/e23597a9a9851e8350b9fc238f81b69c to your computer and use it in GitHub Desktop.

Select an option

Save automagictv/e23597a9a9851e8350b9fc238f81b69c to your computer and use it in GitHub Desktop.

Revisions

  1. automagictv revised this gist May 31, 2022. 1 changed file with 5 additions and 7 deletions.
    12 changes: 5 additions & 7 deletions rpi_python_setup
    Original file line number Diff line number Diff line change
    @@ -17,15 +17,13 @@ sudo make && sudo make altinstall
    # 5 - Install git
    sudo apt-get install git

    # 6 - Install pip
    sudo apt-get install python3-pip
    # If you're having trouble you can build from source but you won't get updates with the apt update command.
    # You'll have to update manually.
    # curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    # sudo python3.9 get-pip.py
    # 6 - Install pipx
    # easiest to handle: https://www.ianwootten.co.uk/2021/11/29/how-to-setup-raspberry-pi-os-bullseye-like-a-python-pro/#pipenv
    python3 -m pip install --user pipx
    python3 -m pipx ensurepath

    # 7 - Pipenv
    sudo apt install pipenv
    pipx install pipenv

    # 8 - Clean up
    cd ..
  2. automagictv revised this gist Apr 14, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rpi_python_setup
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    # 1 - Download Dependencies
    sudo apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev
    sudo apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev libxml2-dev libxslt-dev

    # 2 - Download latest python from https://www.python.org/downloads/source/
    # Make sure to update the version variable or all commands for python will fail
  3. automagictv created this gist Apr 13, 2021.
    34 changes: 34 additions & 0 deletions rpi_python_setup
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    # 1 - Download Dependencies
    sudo apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev

    # 2 - Download latest python from https://www.python.org/downloads/source/
    # Make sure to update the version variable or all commands for python will fail
    export PYTHONVER=3.9.4
    wget https://www.python.org/ftp/python/$PYTHONVER/Python-$PYTHONVER.tar.xz

    # 3 - Extract and configure
    tar xf Python-$PYTHONVER.tar.xz
    cd Python-$PYTHONVER
    ./configure --enable-optimizations

    # 4 - Install python
    sudo make && sudo make altinstall

    # 5 - Install git
    sudo apt-get install git

    # 6 - Install pip
    sudo apt-get install python3-pip
    # If you're having trouble you can build from source but you won't get updates with the apt update command.
    # You'll have to update manually.
    # curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    # sudo python3.9 get-pip.py

    # 7 - Pipenv
    sudo apt install pipenv

    # 8 - Clean up
    cd ..
    sudo rm -r Python-$PYTHONVER
    rm Python-$PYTHONVER.tar.xz
    . ~/.bashrc