Modern Python Projects Transcripts
Chapter: Python versions and packages
Lecture: Installing pyenv
0:00 Let's see how we can install pyenv.
0:02 If you go to the GitHub Repo and scroll a bit down,
0:06 you can see there is this installation section,
0:10 and here you can see that if you're on MAC,
0:12 probably the easiest ways to use Homebrew.
0:15 Otherwise, you can check out the GitHub repository and just follow some steps to find
0:19 here. But probably the easiest way is to use the automatic installer.
0:25 This last option requires you to run one command in your terminal,
0:29 so let's use it. If you go to the pyenv installer repo and scroll
0:34 bit down, you'll find the installation instruction.
0:37 So all you have to do is to run this command in your terminal.
0:42 If you want to see what the script actually does,
0:44 you can open this file in your browser.
0:47 So let's install pyenv. Copy this, and I run it my terminal.
1:01 So, as you can see,
1:02 apart from installing pyenv,
1:04 this installer also installed some additional plugins,
1:08 for example, pyenv-doctor that can be used to verify that the pyenv installation
1:12 is working fine, pyenv-update that can be used to update pyenv, pyenv-virtualenv
1:20 that could be used to manage virtual environments and which-ext that can be used
1:25 to run commands installed outside of the current python version and things like that.
1:33 Those plugins are nice to have,
1:35 but they are not necessary to use pyenv, to verify that pyenv is correctly installed
1:40 We just have to run pyenv command.
1:44 If you see a list off available commands,
1:46 it means that you are all set, if you're not installing pyenv,
1:51 using pyenv installer, but you use Homebrew or you check out the GitHub Repo
1:56 make sure you follow the additional steps specified in the installation instructions.
2:02 So, after you clone the GitHub Repo,
2:04 make sure you export some environment variables.
2:08 I need to make sure that you execute pyenv in it to enable out of
2:11 completion and stuff like that. Once again,
2:14 pyenv installer does everything for you automatically,
2:17 but if you follow those instructions,
2:19 you should also be set. There is one important step that we need to do
2:24 before we can install a new python version,
2:27 and it's to install python build dependencies.
2:31 So, if we open this link,
2:33 you will see that depending on your operating system,
2:35 there are different build dependencies. If you don't have them installed,
2:40 pyenv will do its best to try to install them itself.
2:44 But sometimes it might fail. So it's better to install them yourself.
2:49 If you are on MAC and you're using Homebrew,
2:51 Just run this command in the terminal.
2:53 I have already done that, so I don't have to.
2:55 If you're using Ubuntu, centos fedora,
2:58 you have all the instructions here.
3:02 And once you do this, you are all set.
3:04 In the next video, we are going to install some new python versions.
3:07 But just in case you run into some problems,
3:10 there is a wiki page called Common Build Problems.
3:14 If you have some issues, just go here and maybe you will be able to solve them.