Video Coming Soon...

Created by Zed A. Shaw Updated 2024-12-10 18:57:40
 

40: Advanced Developer Tools

This exercise is all about avoiding "footguns." A "footgun" is a gun specifically designed to shoot yourself right in the foot. It points straight down all the time and has no safety latch, so every time you try to aim a footgun anywhere you just blast your toe off. Software is full of these footguns because of limitations in the software, bad configuration designs, or other oversights of usability.

If you have problems with these instructions and you're reading them in a printed version of the course, then please visit https://learncodethehardway.com/setup/python/ for the latest fixes and install instructions.

Managing conda Environments

Python has a useful feature called "environments", where you can install software specific to a project in a safe place. You "activate" your environment for a project, do you work, and deactivate when you're done. This feature is necessary because you can have conflicting requirements between different projects making it difficult to work on different projects on the same machine.

You create and activate a new environment named "lpythw" with conda:

conda create --name lpythw
conda activate lpythw

Once you do this you should see your shell prompt change to mention lpythw so you know you're in that environment. After this you can install all the software you need, and when you're done you deactivate it:

conda deactivate

You should use a new environment for all of your projects and don't install software in the base environment. This makes it easier to recover from bad installs.

Finally, you can list environments with conda info --envs:

$ conda info --envs
# conda environments:
#
base                     /Users/Zed/anaconda3
lpythw                *  /Users/Zed/anaconda3/envs/lpythw

You can list the packages in an environment with conda list.

Previous Lesson Next Lesson

Register for Learn Python the Hard Way, 5th Edition (2023-2024)

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.