Nov 5, 2020

Python Environments on Fedora 33

How do you use an earlier version of Python for just one project?

Virtual Environments

 

Virtual Environments are also how you use different versions of packages for different projects.

How do you enter into a Virtual Environment, and how do you switch between them?

You "activate" it. Then you are in that Python Virtual Environment until you "deactiviate" it.

First, install the version of Python that you need:

  • $ sudo dnf install python3.8 python3-devel

Second, decide a location and directory name to keep the environment

  • $ mkdir /home/user/Python/deepspeech
  • $ cd /home/user/Python

Third, create the environment

  •  $ python3.8 -m venv /home/user/Python/deepspeech

Fourth, activate the environment

  • $ source /home/user/Python/deepspeech/bin/activate

Last, to exit the virtual environment

  • $ deactivate


No comments:

Post a Comment