Modern Python Projects Transcripts
Chapter: Python versions and packages
Lecture: Installing pyenv

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's see how we can install pyenv. If you go to the GitHub Repo and scroll a bit down, you can see there is this installation section,
0:11 and here you can see that if you're on MAC, probably the easiest ways to use Homebrew.
0:16 Otherwise, you can check out the GitHub repository and just follow some steps to find
0:20 here. But probably the easiest way is to use the automatic installer. This last option requires you to run one command in your terminal,
0:30 so let's use it. If you go to the pyenv installer repo and scroll bit down, you'll find the installation instruction.
0:38 So all you have to do is to run this command in your terminal. If you want to see what the script actually does,
0:45 you can open this file in your browser. So let's install pyenv. Copy this, and I run it my terminal.
1:02 So, as you can see, apart from installing pyenv, this installer also installed some additional plugins,
1:09 for example, pyenv-doctor that can be used to verify that the pyenv installation
1:13 is working fine, pyenv-update that can be used to update pyenv, pyenv-virtualenv
1:21 that could be used to manage virtual environments and which-ext that can be used
1:26 to run commands installed outside of the current Python version and things like that. Those plugins are nice to have,
1:36 but they are not necessary to use pyenv, to verify that pyenv is correctly installed We just have to run pyenv command.
1:45 If you see a list off available commands, it means that you are all set, if you're not installing pyenv,
1:52 using pyenv installer, but you use Homebrew or you check out the GitHub Repo
1:57 make sure you follow the additional steps specified in the installation instructions. So, after you clone the GitHub Repo,
2:05 make sure you export some environment variables. I need to make sure that you execute pyenv in it to enable out of
2:12 completion and stuff like that. Once again, pyenv installer does everything for you automatically, but if you follow those instructions,
2:20 you should also be set. There is one important step that we need to do before we can install a new Python version,
2:28 and it's to install Python build dependencies. So, if we open this link, you will see that depending on your operating system,
2:36 there are different build dependencies. If you don't have them installed, pyenv will do its best to try to install them itself.
2:45 But sometimes it might fail. So it's better to install them yourself. If you are on MAC and you're using Homebrew,
2:52 Just run this command in the terminal. I have already done that, so I don't have to. If you're using Ubuntu, centos fedora,
2:59 you have all the instructions here. And once you do this, you are all set. In the next video, we are going to install some new Python versions.
3:08 But just in case you run into some problems, there is a wiki page called Common Build Problems.
3:15 If you have some issues, just go here and maybe you will be able to solve them.

Talk Python's Mastodon Michael Kennedy's Mastodon