To use a specific pyenv environment in a systemd service, you'll need to provide the path to the desired Python interpreter in the virtual environment and set the environment variable PATH accordingly in the service file.
Here's a step-by-step guide to crafting a systemd service file that uses a pyenv virtual environment:
- Find the path to the desired Python interpreter in the virtual environment.
You can do this by running the following command (replace <your_virtualenv> with the name of your virtual environment):
$ pyenv which python -p <your_virtualenv>