iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🛸

Setting Up a venv Virtual Environment for AITubers (WSL2)

に公開

Introduction

Recently, I bought the book "AITuberを作ってみたら生成AIプログラミングがよくわかった件" (How I understood Generative AI programming better by making an AITuber)!
https://bookplus.nikkei.com/atcl/catalog/23/10/31/01079/
I wanted to try making an AITuber right away and started reading, but since the venv configuration for WSL2 environments wasn't covered, I researched and set it up myself. I hope this helps you even a little in creating a virtual environment for your AITuber!

Last time, I set up the Python environment using Pyenv.
https://zenn.dev/yasuna/articles/b3eae0ed00e665

This development environment

Creating a virtual environment with venv

venv is a Python tool for creating virtual programming environments. Once Python is installed, venv is available by default.
For more details on venv, please see the following link:
https://docs.python.org/3/library/venv.html

This time, we will create a virtual environment in WSL2 using venv.

First, create a directory called aituber.
I created it inside a projects folder.

:~/projects $ mkdir aituber

Then, move into the aituber directory with the cd command.

:~/projects $ cd aituber

Run the following command in the aituber directory to create a virtual environment with venv:

:~/projects/aituber $ python3 -m venv .venv

Once the command is executed, a .venv directory will be created inside the aituber directory.

:~/projects/aituber $ ls -a
.  ..  .venv

Run the following command to activate the venv virtual environment:

:~/projects/aituber $ source .venv/bin/activate
(.venv) :~/projects/aituber $ mkdir aituber

The (.venv) prompt appears!
Now you can develop applications within the virtual environment created with venv.

If you want to work on other applications or deactivate the current virtual environment, run the following deactivate command:

(.venv) :~/projects/aituber $ deactivate
:~/projects/aituber $

Summary

Now you are all set to create a virtual environment with venv and start developing applications!
I'm really excited to finally start building an AITuber 🔥🔥🔥

https://bookplus.nikkei.com/atcl/catalog/23/10/31/01079/

GitHubで編集を提案

Discussion