AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Find all python versions mac9/16/2023 ![]() PROTIP: There may be several Python executables installed in different folders. You are good to go with Pipenv if you see in the first response to the type -a python command (but instead of “wilson_mar”, you’ll see your own user name): python3 is /Users/wilson_mar/.pyenv/shims/python3 Python3 is is /usr/local/anaconda3/bin/python Python is /Users/wilson_mar/anaconda3/bin/python So Homebrew and other installers install to the User-owned /usr/local/ which does NOT require sudo to access.ĭifferent installers install Python in different paths (but instead of “wilson_mar”, you’ll see your own user name): python is /Users/wilson_mar/.pyenv/shims/python PROTIP: The /usr/bin/ folder is owned by the operating system, so elevated sudo priviledges are required to modify files in it (such as “python”). Get a list of the various locations where Python is installed (by various installers): type -a pythonĪ new macOS version would show: python is /usr/bin/python PROTIP: Before installing things, first see what is already installed. The alternative to Pyenv is Conda and MiniConda. Thus, which aws would return: /Users/wilson_mar/.pyenv/shims/aws Competitors ![]() This technique is possible because the operating system searches for executables in folders in the PATH from left to right. That’s achieved by a line at the bottom of your ~/.bash_profile which makes the operating system search in the shims folder for programs: export PATH="$PYENV_ROOT/shims:$PATH" Pyenv uses a technique called “rehashing” so it can switch among multiple versions of Python2 or Python3.Ĭommands for the operating system to execute “python3” are intercepted by a shim executable which passes commands along to the actual Python installation of the desired version. Why? Because I haven’t seen one on the internet. Here is a hands-on “deep dive” tutorial so you better grasp the complexities in a shorter time. In this article I take a carefully crafted narrated tour. Switch between installed versions without resetting your bash session.Dynamically specify the exact Python version you want.Install multiple parallel versions of Python.Install Python in your user space (without need for sudo).Pipenv brings “the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world.” “PROTIP:” here highlight information I haven’t seen elsewhere on the internetīecause it is hard-won, little-know but significant factsīased on my personal research and experience. Not intended to represent any employer (past or present). NOTE: Content here are my personal opinions, and ![]() This tutorial describes the different options to install, uninstall, configure, and use various versions of Python with its various packages, all running in a virtual environment also managed by pyenv. ![]()
0 Comments
Read More
Leave a Reply. |