Skip to main content

Environmental Setup

Getting Started:

Learn:

Install:


Creating a Python Virtual Environment:

  1. Navigate/create directory (folder) where the project is
    Navigate/create directory

  2. Create the python virtual environment
    Create venv

    The command python -m venv .venv is used:

    • -m runs a specific Python module
    • venv is the module for creating virtual environments
    • .venv is the name of the directory for the environment
  3. Activate python virtual environment
    Activate venv

    Inside the project directory (parent of .venv), run:

    . ./.venv/Scripts/activate
    
    • . is shorthand for source
    • ./ runs a script using a relative path
    • activate is the script that starts the environment
    • You’re in the virtual environment if you see (.venv) in your prompt
  4. Using Python and Pip in a virtual environment

    • Use .venv/bin/pip and .venv/bin/python to use the environment's versions
  5. Running the bot for the first time

    • Run the following commands inside the virtual environment:

      .venv/bin/pip install httpx
      .venv/bin/pip install discord
      .venv/bin/pip install pyyaml
      .venv/bin/pip install audioop-lts
      .venv/bin/pip install apscheduler
      
    • If you get a "module not found" error, try installing that module with pip.

  6. Deactivating the virtual environment
    Deactivate venv

    • Navigate to .venv/Scripts and run:

      deactivate
      
    • If (.venv) disappears from your prompt, it worked.

  7. Creating a server and bot account