![]() Inside our environment we cannot access system-wide site packages and any packages we install will not be accessible outside of our environment. We’re now inside an active virtual environment (indicated by the command prompt prefixed with the name of the active environment).Īt this point we would work on our project as usual, safe in the knowledge that our project is completely isolated from the rest of our system. % source venv/bin/activate (venv) % # Fancy new command prompt ![]() The only thing left to do is to “activate” our environment by running the scripts we mentioned earlier. ♻️ Reminder: A virtual environment is itself a directory. Now our project looks like this: test-project/ ├── data ├── deliver ├── develop ├── src ├── tests └── venv # There it is! Voilà! A virtual environment has been born. ⚠️ Note: You can replace “venv/” with a different name for your environment. % cd test-project/ % python3 -m venv venv/ # Creates an environment called venv/ test-project/ ├── data ├── deliver # Final analysis, code, & presentations ├── develop # Notebooks for exploratory analysis ├── src # Scripts & local project modules └── testsĪll we need to do is execute the venv module, which is part of the Python standard library. Say we wanted to create a virtual environment for a project we’re working on called test-project/, which has the following directory tree. Using Virtual Environments Creating Environments ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |