How to Install and Run Multiple Python Versions on macOS | pyenv & virtualenv Setup Tutorial

  Рет қаралды 49,230

k0nze

k0nze

Күн бұрын

This video will show you how to install and run different Python versions on macOS using pyenv. You will learn to seamlessly switch between multiple Python versions and set specific Python versions for dedicated folders. Additionally, we will set up virtual environments (virtualenv) for your Python projects and use them in Visual Studio Code.
⏬ Get my FREE Python Cheat Sheets: k0nze.gumroad.com
🖥️ pyenv GitHub Repo: github.com/pyenv/pyenv
👉 Website for this Video: k0nze.dev/posts/install-pyenv...
💌 Support me on Patreon: / k0nze
☕️ Buy me Coffee: www.buymeacoffee.com/k0nze
🌍 Check out my Website: k0nze.dev
💻 Join our Discord: discord.k0nze.dev
👔 Follow me on LinkedIn: linkedin.k0nze.dev
Recording Gear
Camera - Sony A6400: geni.us/zRw1
Lens - Viltrox AF 23mm f1.4: geni.us/RVrguGd
Microphone - Rode Wireless Go: geni.us/RBAOIx
Keyboard - Keychron K2 v2: geni.us/DPK87Xn
⏰ Timestamps:
0:00 Intro
0:55 Install pyenv on macOS
3:22 Install Python through pyenv
4:52 Set global Python version with pyenv
5:37 Install latest Python release candidate with pyenv
6:27 Set a specific Python version for a project
7:17 Using Python virtual environments with pyenv
8:45 Use Python virtual environments in VSCode
10:12 Outro

Пікірлер: 104
@k0nze_builds
@k0nze_builds 2 жыл бұрын
Download FREE Python Cheat Sheets: k0nze.gumroad.com
@HannahRobinsonNZ
@HannahRobinsonNZ 2 ай бұрын
Thank you so much for this brilliant video and the helpful blog post! It is by far the clearest and most complete explanation I've found.
@nelsonfleig5024
@nelsonfleig5024 12 күн бұрын
Super helpful video! Was looking for something similar to NVM for Python and this fit the bill perfectly!
@mistersquid
@mistersquid 5 ай бұрын
Thank you for your clear explanation of how to manage python versions. First rate.
@marrufomcbo
@marrufomcbo Жыл бұрын
thanks! very detailed and helpful! you got yourself a new follower today
@muhammadhummayunyousaf6579
@muhammadhummayunyousaf6579 2 жыл бұрын
I spent 6 hours finding the solution. Then, I found your video. Thank buddy
@k0nze_builds
@k0nze_builds 2 жыл бұрын
I'm glad the video was helpful for you and that you could fix your problem!
@ianjeffries7972
@ianjeffries7972 3 ай бұрын
Virtual environments and different python versions were the bane of my existence until this video. Thanks mate!
@BlancoYT
@BlancoYT Жыл бұрын
Very well explained I wish I found this when I needed it 4 months ago :(
@merc1er
@merc1er 2 жыл бұрын
High quality video, thank you!
@k0nze_builds
@k0nze_builds 2 жыл бұрын
I'm glad the you enjoyed the video and it was helpful for you Corentin!
@thecodechapter
@thecodechapter 11 ай бұрын
You were really helpful. Thanks :)
@talhaahmed-nb7tk
@talhaahmed-nb7tk Жыл бұрын
It was really helpful. well explained as well.
@user-im2do3vq8p
@user-im2do3vq8p 11 ай бұрын
Hi @k0nze, thanks for the great content. Is is very helpful
@sachuynhvan385
@sachuynhvan385 2 жыл бұрын
Excellent! Thanks for your video
@k0nze_builds
@k0nze_builds 2 жыл бұрын
I'm happy the video was helpful for you!
@ederarmandoanillolora3048
@ederarmandoanillolora3048 5 ай бұрын
Good video. Absolutely awesome!
@maheshmagalage1886
@maheshmagalage1886 2 жыл бұрын
This is golden! Thank you!
@k0nze_builds
@k0nze_builds 2 жыл бұрын
I'm happy I could help you out Mahesh!
@jeffabc1997
@jeffabc1997 2 ай бұрын
thank you. Great video!
@mgh9271
@mgh9271 10 ай бұрын
Very well explained.
@bls512
@bls512 2 жыл бұрын
Thanks for this! Nice website :)
@k0nze_builds
@k0nze_builds 2 жыл бұрын
Glad you like it!
@SpencerDavis2000
@SpencerDavis2000 2 жыл бұрын
great clear tutorial thanks
@zhuweivideo
@zhuweivideo 2 жыл бұрын
Great! that is exactly what I need
@k0nze_builds
@k0nze_builds 2 жыл бұрын
I'm happy the video was helpful for you!
@jpablomayorga
@jpablomayorga Жыл бұрын
Gracias excelemte video, me acabas de salvar y ahorrarme futuros dolores de cabeza
@fayyaznaeem5241
@fayyaznaeem5241 2 жыл бұрын
Excellent! Thank you :)
@k0nze_builds
@k0nze_builds 2 жыл бұрын
You're very welcome!
@yasin2210
@yasin2210 2 ай бұрын
you are awesome man!!
@MicheleSblendorio
@MicheleSblendorio 4 ай бұрын
Very weel explained! Which Is the terminal do you use with colored branches?
@roberthmejias
@roberthmejias 2 жыл бұрын
Thanks a lot!!! you're awesome
@k0nze_builds
@k0nze_builds 2 жыл бұрын
Thank you Roberth! I'm happy it was helpful for you
@juliensallerin4641
@juliensallerin4641 2 жыл бұрын
Great ressource , thanks
@k0nze_builds
@k0nze_builds 2 жыл бұрын
I'm glad it was helpful for you Julien!
@seraphimwang
@seraphimwang 2 жыл бұрын
Humongous thanks 🙏🏻!
@indraalapati989
@indraalapati989 6 ай бұрын
Awesome. What are the differences and benefits of pyenv over conda ?
@darkredtulip
@darkredtulip Жыл бұрын
Hi k0nze, thank you so much for this video, it is so helpful! At 5:08 you mention the pyenv global code, for some reason this doesn't work for me. If I enter pyenv versions, my chosen python version shows, but as soon as I use the global code and open a new terminal, it doesn't show my chosen python version. Do you know why?
@adarshabenki1826
@adarshabenki1826 Жыл бұрын
this is good. thanks
@fayax
@fayax Жыл бұрын
Excellent!!
@jairunet
@jairunet 2 жыл бұрын
Hello K0onze, great video and straight to the point, my only question is what's the value? difference? between installing it using brew vs github what extra control or benefit do you get? I am just curious to know, thank you again, subscribed and definitely checking what other cool useful videos you have on your channel.
@thuggfrogg
@thuggfrogg Жыл бұрын
Great question... So, the value is not having to me ME right now. I'm currently wondering why the library I just downloaded isn't working, despite having downloaded the dependencies. It's super frustrating, and I've been here many times before. Every time I've sorted out this problem in the past, I was able to continue my project without a problem, so it didn't seem like a big deal. But now, I'm realizing that every time I put down python for a month or I switch the types of projects I'm working on (such as API dev vs data science), then I try to go back to whatever I was doing a month ago, shit's broken. So, you won't see the value of doing this if you're doing it right from the beginning. If you want to experience the pain that lead to the need for environment management, then feel free to go ahead and use your base python environment ;) .
@jairunet
@jairunet Жыл бұрын
@@thuggfrogg I see, thank you for that info, I hope to hear some other reasons as well especially from K0nze?
@bbrendon
@bbrendon Жыл бұрын
Whoa! No downvotes? Well done!
@0797cjm
@0797cjm 2 жыл бұрын
Ps what profile are you using for your cmd? I like how yours is setup with the blue arrow
@zaratt
@zaratt 2 жыл бұрын
Hi. Great video and and read on the website site as well. I have 2 questions: 1 - I have installed Xcode, but it wasn't by command line. Do I need to install anyway? 2 - In brew install openssl readline sqlite3 xz zlib, is SQLite the database you use? My idea is to use Mysql to learn and do some tests. In that case do I have to change or has nothing to do with it? Thanks
@k0nze_builds
@k0nze_builds 2 жыл бұрын
I'm happy you enjoyed the video Alandson. 1 - XCode installs the command line tools when you installed in with the installer. When you run the command and XCode is already installed it will check that and won't install the command line tools a second time. 2 - SQLite is the standard database that is integrated into Python, it is needed to compile Python from scratch (which pyenv does). Don't change the command otherwise pyenv will will fail. You can install MySQL, MariaDB, Postgres, etc. parallel to SQLite without any issues.
@hamedmatari2577
@hamedmatari2577 2 жыл бұрын
thanks for sharing
@k0nze_builds
@k0nze_builds 2 жыл бұрын
Thanks for watching!
@user-ef7rv7dh9d
@user-ef7rv7dh9d 9 ай бұрын
good tutorial
@murtadha96
@murtadha96 Жыл бұрын
Thanks!
@ghalebevaldo4416
@ghalebevaldo4416 2 жыл бұрын
great channel and content. thanx
@k0nze_builds
@k0nze_builds 2 жыл бұрын
Thank you Ghaleb! I'm happy you enjoy the content.
@ghalebevaldo4416
@ghalebevaldo4416 2 жыл бұрын
@@k0nze_builds wir können ja auf deutsch schreiben. Tübingen habe ich auch mal gewohnt nach den Studi-Zeiten ;-) Genau Deinen Content habe ich eigentlich gesucht. Verwunderlich, dass Du nicht mehr Abonnenten hast. Ist großes Kino hier Dein Installationsvideo. Die Conda usw. Installationen gingen mir auf den Sack. Vielen Dank dafür. VG Evaldo
@k0nze_builds
@k0nze_builds 2 жыл бұрын
Tübingen ist eine sehr schöne Stadt. Leider arbeite ich da nur und wohne nicht dort. Mit den Subscribern habe ich noch Zeit. Den Kanal gibt es erst seit drei Wochen. Ich hatte mal einen anderen KZfaq Kanal zu einem anderen Thema und habe da viel gelernt über das Produzieren von Videos usw.
@ghalebevaldo4416
@ghalebevaldo4416 2 жыл бұрын
@@k0nze_builds alles klaro, 3 Wochen ist ja in der Tat ganz neu. Wünsche Dir viel Erfolg und Spass. Ich bin ja Abonnent und dann up to date
@k0nze_builds
@k0nze_builds 2 жыл бұрын
Danke!
@vickie_chan
@vickie_chan 2 жыл бұрын
Great job.
@k0nze_builds
@k0nze_builds 2 жыл бұрын
I'm glad you enjoyed the video and that it was helpful for you Vickie.
@vickie_chan
@vickie_chan 2 жыл бұрын
@@k0nze_builds yes really it was helped me.
@Grapegum
@Grapegum Жыл бұрын
Hi @k0nze, thanks for the great content! I was following this guide (I'm pretty new to everything coding btw), and I got a message on terminal that says "zsh: command not found: code" I know there's bash, zhs and even something called fish (?) but I have no idea what the differences are, which one should I use and how to change between them. Does it mean all I've been doing needs to be redone in bash? I'm so lost 😢 (I do have VS Code installed in my Mac btw)
@joshuanareshmastachimendoz9990
@joshuanareshmastachimendoz9990 Жыл бұрын
Zsh, Bash and Fish are "shells" (I don't know how to explain what they are, but it's not a big deal). Since the message says "zsh: ..." it means you're using Zsh (which in a lot of things is similar to Bash). The message means it doesn't find a little program called "code" in the PATH (PATH is basically a list of directories in which the system looks for programs or scripts for the terminal). This program calls VSCode to open, so you need to go to VSCode and install "code" in your system so you can call VSCode from the terminal.
@0797cjm
@0797cjm 2 жыл бұрын
Do you have a discord or anything? I seemed to have completely screw my putting and pip on my intel Mac running Monterey. I want Python to recognize Python 3.10 which it currently displays 3.8. I’ve tried everything but I messed something up. When I use pip it shows a location but when I use a pip conman d it says no module found. I tried installing pocketsphinx and since then have been having issues. If you wouldn’t mind helping it would be greatly appreciated. Awesome video!
@IbrahimKaleel-jp4el
@IbrahimKaleel-jp4el 14 күн бұрын
@k0nze_builds, what is the purpose of this command -> "xcode-select --install"
@felliperibeiroteixeira
@felliperibeiroteixeira Жыл бұрын
Hi I have a question here, being Linux and Mac based on Unix, can the python virtual machine created on Mac run on Linux? or do you have to install python on Linux and create a virtual machine there?
@ilushasm
@ilushasm Жыл бұрын
Hello, K0onze After following your video step by step and installing python with pyenv i got following error in python console in pycharm: "pydev debugger: CRITICAL WARNING: This version of python seems to be incorrectly compiled (internal generated filenames are not absolute)" how can i fix it?
@aintyourcupoftea
@aintyourcupoftea Жыл бұрын
which theme are you using with your terminal?
@parhamfa
@parhamfa 2 жыл бұрын
I get "BUILD FAILED (OS X 12.3 using python-build 20180424)" error with any version of 3.6.x to 3.9.x
@kelstongroup
@kelstongroup 2 жыл бұрын
I am getting the same error
@parthtailor1189
@parthtailor1189 Жыл бұрын
did you get solution?
@andrehenrique813
@andrehenrique813 Жыл бұрын
thank u
@fernandonieto874
@fernandonieto874 Жыл бұрын
Hi K0nze, I installed pyenv using your video tutorial. I tried to install the 2.6.4 version of python to run an application that requires it. I got this error message, "ERROR: The Python zlib extension was not compiled. Missing the zlib?", and the build failed. I looked online for fixes but I wasn't able to find one that fixed the problem. Any idea why it failed? thank you
@rogerward6242
@rogerward6242 2 жыл бұрын
For anyone who notices that pyenv doesn't change the version output when you run python -V, you need to run pyenv init --path and then open a new shell, then changing the pyenv will change the output of python -V
@khasanshadiyarov
@khasanshadiyarov 2 жыл бұрын
Nope, doesn't work
@khasanshadiyarov
@khasanshadiyarov 2 жыл бұрын
Thank you I got my own solution using ur advice with pyenv init --path
@Luiz_Aquino
@Luiz_Aquino Жыл бұрын
how I do that
@alwayserik
@alwayserik 2 жыл бұрын
Why didn't we use pyenv-virtualenv?
@sarimkhan2306
@sarimkhan2306 Жыл бұрын
global and local command was not working? please guid me and where was the venv file created?
@robertoenriquegarciamartinez
@robertoenriquegarciamartinez 9 ай бұрын
K0nze what if i already executed the command: "pip3 install virtualenv" and it works?... but when i execute pyenv doesnt works... can i still aproach your solution ???
@CanDoSo_org
@CanDoSo_org 10 ай бұрын
Why do I get this: $ python -v zsh: command not found: python if I use this command: $ python3 --version Python 3.9.6 (but I installed the version 3.11.4)
@user-wr4yl7tx3w
@user-wr4yl7tx3w 2 жыл бұрын
Can pyenv be used together with Poetry?
@k0nze_builds
@k0nze_builds 2 жыл бұрын
Yes, you can use pyenv with poetry. I actually use pyenv together with poetry daily.
@bishwokarki9884
@bishwokarki9884 2 жыл бұрын
pyenv global 2.7.12 this part is not setting global version in my mac. please help
@k0nze_builds
@k0nze_builds 2 жыл бұрын
Is there any warning or error message?
@romantheroman98
@romantheroman98 11 ай бұрын
I have installed pyenv on my mac. My sys version is 3.11 and I have a directory where I want to use 3.9. So I have ran pyenv local 3.9.x in that directory and it created that .python-version file though if I type no python ... it says command not found or if I typ python3 in that directory it still shows me the system version 3.11. Any help?
@AiEnthusiast999
@AiEnthusiast999 11 ай бұрын
To add the required pyenv initialization to your .zshrc file, you can append the following lines at the end of the file: # Pyenv configuration if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)" fi
@romantheroman98
@romantheroman98 11 ай бұрын
@@AiEnthusiast999 I have fixed my problem by adding some lines to my .bash_profile and running source .bash_profile. Now for some reason when running python3 -V the lower python version set via pyenv in my local project is acknowledged
@romantheroman98
@romantheroman98 11 ай бұрын
@@AiEnthusiast999 Ah probably that is exactly what you suggested but for zsh shell right?
@AiEnthusiast999
@AiEnthusiast999 11 ай бұрын
@@romantheroman98 yes
@super_po
@super_po 2 жыл бұрын
I cannot install any python version to my mac. I always got this make: *** [Programs/_testembed] Error 1 make: *** Waiting for unfinished jobs.... make: *** [python.exe] Error 1. Could someone help me? Thx
@kreestheshooter
@kreestheshooter 2 жыл бұрын
Enjoyed the video, but pyenv is giving me some issues. How do I remove it?
@k0nze_builds
@k0nze_builds 2 жыл бұрын
You can remove pyenv by removing the pyenv directory you cloned from github and remove the PATH extension and the init from your zshrc.
@kreestheshooter
@kreestheshooter 2 жыл бұрын
@@k0nze_builds Could you give a bit more of a detailed explanation? I'm really a beginner with this stuff.. Was able to remove the commands from the zshrc and remove the pyenv directory. All of the python versions I installed through pyenv are gone, but pyenv is not.
@k0nze_builds
@k0nze_builds 2 жыл бұрын
@@kreestheshooter When you removed the pyenv directory and all the lines added to the zshrc pyenv is uninstalled otherwise you have missed removing something. Also consult the official uninstall instructions: github.com/pyenv/pyenv#uninstalling-pyenv
@looploop6612
@looploop6612 Жыл бұрын
not working for M1
@quenting4885
@quenting4885 Ай бұрын
I hope someone could help me. When using : python -m venv .venv It take lot of time and I have to do ctrl-c, but it seem to work. When activating .venv my python command change path but not pip. Dispite having a working pip installed. Using python -venv --without-pip .venv Work fine, but as intended it doesn't install pip. Does anyone know how to solve this strange issue?
@rickyardo2944
@rickyardo2944 Жыл бұрын
I stopped watching when I heard "...and i already installed the xcode command line tools before..." Why? because, in a Tutorial worth watching nothing should be assumed. In a Tutorial worth watching ,you should show how to find out if something is already installed and where and what version and if it needs updating and how... I will stop here...
@surajmatta9204
@surajmatta9204 Жыл бұрын
Tried to installed 3.7.2. getting this Error BUILD FAILED (OS X 12.6 using python-build 2.3.5-16-ge0311823) Inspect or clean up the working tree at /var/folders/gn/2tnktwvs1pjbqrg5_mshr1680000gn/T/python-build.20221101133007.5853 Results logged to /var/folders/gn/2tnktwvs1pjbqrg5_mshr1680000gn/T/python-build.20221101133007.5853.log
@khasanshadiyarov
@khasanshadiyarov 2 жыл бұрын
OOOOOK Ladies and Gentelmen, for people who can't change python version via pyenv global X.X.X, DO NEXT: 1. Type pyenv init --path 2. Copy the output 3. Place it first line in next files: ~/.bashrc, ~/.zshrc, ~/bash_profile 4. Open new terminal and type pyenv global X.X.X again Thank you
@42kilam36
@42kilam36 2 жыл бұрын
Where do i paste the output?
@dikshyakasaju7541
@dikshyakasaju7541 Жыл бұрын
Great video but this doesn't really work for ARM64 architecture. Would be great if you could upload a video which is specifically for ARM64. Error as below: BUILD FAILED (OS X 12.6 using python-build 2.3.9-1-gff93c58b) Inspect or clean up the working tree at /var/folders/85/f8v3b1zn62j3czh7dwwfm57w0000gn/T/python-build.20221221110735.14977 Results logged to /var/folders/85/f8v3b1zn62j3czh7dwwfm57w0000gn/T/python-build.20221221110735.14977.log Last 10 log lines: "_libintl_textdomain", referenced from: _PyIntl_textdomain in libpython3.9.a(_localemodule.o) _PyIntl_textdomain in libpython3.9.a(_localemodule.o) ld: symbol(s) not found for architecture x86_64 ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Programs/_testembed] Error 1 make: *** Waiting for unfinished jobs.... make: *** [python.exe] Error 1
@puneethshankar460
@puneethshankar460 Жыл бұрын
* system (set by /Users/puneeth.shankar/.pyenv/version) anaconda3-2022.05 zsh: command not found: python zsh: command not found: anaconda
virtualenv vs. venv (beginner - intermediate) anthony explains #040
11:22
anthonywritescode
Рет қаралды 40 М.
Василиса наняла личного массажиста 😂 #shorts
00:22
Денис Кукояка
Рет қаралды 5 МЛН
Её Старший Брат Настоящий Джентельмен ❤️
00:18
Глеб Рандалайнен
Рет қаралды 7 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:19
CRAZY GREAPA
Рет қаралды 8 МЛН
Setting up M2 MacBook Air For Programming
16:28
Andres Vidoza
Рет қаралды 1 МЛН
Python install with pyenv on Mac
8:14
THETA 360 Developers
Рет қаралды 5 М.
The Ultimate Mac Terminal Setup - Beginner Tutorial
8:22
warpdotdev
Рет қаралды 237 М.
Manage Multiple Python Versions with PyEnv
9:54
NeuralNine
Рет қаралды 16 М.
How To Make Your Boring Mac Terminal So Much Better
10:42
Josean Martinez
Рет қаралды 700 М.
Learn Python With This ONE Project!
55:04
Tech With Tim
Рет қаралды 1,6 МЛН
Unleash the power of Local LLM's with Ollama x AnythingLLM
10:15
Tim Carambat
Рет қаралды 100 М.
Василиса наняла личного массажиста 😂 #shorts
00:22
Денис Кукояка
Рет қаралды 5 МЛН