. venv/bin/activate
This is a command to activate a Python virtual environment. Before using it, you need to install a Python virtual environment and install the Python packages you need in the virtual environment. This avoids dependency conflicts between multiple Python projects. If you already have a Python virtual environment and need to activate it on a Linux or macOS operating system, you can run the following command in a terminal:
source venv/bin/activate
If you are using the Windows operating system, you can enter on the command line:
venv\Scripts\activate
This will allow you to enter the virtual environment.
Let's take a look at the installation record of installing WeChat group robots:
First switch root to the myenv environment
$ python3 -m venv myenv
$ source myenv/bin/activate
$ python3 -m pip install --upgrade pip
Exit method:
deactivate
Installation dependencies:
pip3 install itchat-uos==1.5.0.dev0
pip3 install --upgrade openai
******
pip install pillow
****
You are using pip version 8.1.2, however version 23.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
maybe:
pip install --upgrade pip
****
***
ModuleNotFoundError: No module named 'qrcode'
to do :
pip install qrcode
maybe:
sudo yum install python-pip
ModuleNotFoundError: No module named 'PIL'
to do :
pip install pillow
***
View running programs
ps -ef | grep app.py | grep -v grep
kill process (number)
Startup
After the configuration modification is completed and the dependencies are installed, we can run the program.
Use the nohup command to run a program in the background:
touch nohup.out # The first run needs to create a new log file
nohup python3 app.py & tail -f nohup.out # Run the program in the background and output the QR code through the log
*******