Just like last time, you'll need to create a virtualenv in order to install specific libraries.
First, if you reinstalled your Linux/WSL/VM from last time, ensure that you have the prerequisites installed (it never hurts!):
sudo apt install python3 python3-venv python3-pip
Navigate to your work directory, e.g., lab04
and build your virtual environment:
mkdir -p lab04 && cd lab04 python3 -m venv .venv # don't forget to activate your environment each time you start a new shell: source .venv/bin/activate
Now, to get to the specifics of today's lab, we need some extra dependencies:
# you need extra system libraries installed with your distro's package manager sudo apt install libffi-dev libnacl-dev python3-dev # and our target Python libraries: pip3 install 'py-cord[voice]' PyNaCl ipython pip3 list
So, what are these, exactly?
In the previous labs, you used the python3 interpreter in interactive mode. Now, we upgrade to ipython. This new interpreter offers an enhanced user experience by means of color coding, tab completion, multi-line editing, etc. For scripting purposes, python3 should remain your interpreter of choice. But for prototyping, we suggest using this. For now, let's see if the discord module in the py-cord[voice] package is available to import.
$ ipython Python 3.9.7 (default, Oct 10 2021, 15:13:22) Type 'copyright', 'credits' or 'license' for more information IPython 7.29.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: import discord In [2]: discord? In [3]: discord?? In [4]: help(discord)
Note how in stead of help, in ipython we can ?
or ??
to something to access a brief / more complete documentation.