Skip to content

Instantly share code, notes, and snippets.

@scarletcafe
Last active August 6, 2024 03:25
Show Gist options
  • Save scarletcafe/c02bd9cbfc647b1f80972bcfc327fa53 to your computer and use it in GitHub Desktop.
Save scarletcafe/c02bd9cbfc647b1f80972bcfc327fa53 to your computer and use it in GitHub Desktop.
Installing Python & discord.py: A Primer

Windows Installation

First, go to python.org:

https://i.imgur.com/VkCK31Z.png

Hover over Downloads and select the Windows category (do NOT press the instant download button):

https://i.imgur.com/enFmiRi.png

From here, find the latest 3.6 (NOT 3.7, NOT 3.5) release and choose the x86-64 executable installer.

https://i.imgur.com/wBSPEbV.png

Tick the Add Python to PATH box and then press Install Now.

https://i.imgur.com/S91jEo0.png

Once the installation is done, press Close.

https://i.imgur.com/NOgoDDq.png

Open Command Prompt by typing cmd into Search.

https://i.imgur.com/w3PZY96.png

Install discord.py by using:

  • py -3.6 -m pip install -U discord.py[voice] for voice support
  • py -3.6 -m pip install -U discord.py for without voice support

https://i.imgur.com/qqvLbpw.png

Once the command finishes, discord.py has been successfully installed:

https://i.imgur.com/QKbj5Qb.png

To run your bot script, go to where it is located, hold Shift and right click in an empty space in the folder, and press Open command window here:

https://i.imgur.com/b41d2dC.png

Then type py -3.6 <name of your script> (make sure to include the .py):

https://i.imgur.com/exBS7NX.png

Your bot is now running.

Ubuntu installation

Select Activities or press the Super button to open Search:

https://i.imgur.com/px7rgmg.png

Once in Search, type in Terminal and select it:

https://i.imgur.com/DXFOOYo.png

Type in sudo apt-get update, typing in your password when prompted, to update your package repositories (this may take a while):

https://i.imgur.com/piAExLF.png

Once the repositories are updated, type in sudo apt-get install python3-dev python3-pip libffi-dev libopus-dev to install Python and voice libraries. When prompted, type y to confirm installation:

https://i.imgur.com/EYRrGRa.png

Install discord.py by using:

  • python3 -m pip install -U discord.py[voice] for voice support
  • python3 -m pip install -U discord.py for without voice support

Note that PyNaCl may take a long time to compile.

https://i.imgur.com/QLpyb5s.png

Once the command finishes, discord.py has been successfully installed:

https://i.imgur.com/Vr2M2sy.png

To run your bot script, go to where it is located, right click in an empty space in the folder, and press Open in Terminal:

https://i.imgur.com/poBWlnP.png

Then type python3 <name of your script> (make sure to include the .py):

https://i.imgur.com/P8GkKWD.png

Your bot is now running.

@MuffinHeadLord
Copy link

idk how to do the last step

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment