Instead of simply installing the latest version of Python directly through Homebrew, APT or from into our global system environment, we will install it using a tool called pyenv. The project folders at this stage were created simply ready for future use - designated, isolated environments where I could start to build my first projects. Into the specific training course folders, I was then able to install Python versions that aligned to the particular training courses along with any specific libraries or modules needed to complete the course or tutorial. I installed the latest version of Python into this environment and freely installed all libraries and modules that I wanted to experiment with, safe in the knowledge that they would be fully isolated and would not impact my overall development environment. ![]() I used the Python Playground folder as a safe place to experiment and try variations of what I was learning from training tutorials. You will notice that within the Learning directory, I created a folder called Python Playground in addition to specific Training Course folders. In the subsequent sections you will learn how you can install / allocate specific Python versions to each of these folders, and how creating a separate virtual environment for each folder allows you to have full control over what libraries and modules you install into each one. > Python -> Learning -> Python_Playground -> Training_Course1 -> Training_Course2 -> Projects -> Project1 -> Project2 The structure illustrated below worked for me as it allowed me to ring fence my initial learning activity whilst creating a space that I could evolve into once I had developed sufficient skills to start to work on some specific projects of my own. To install Homebrew, simply copy the below line into your terminal window and then follow any on screen instructions: /bin/bash -c “$(curl -fsSL )"īefore you install Python and start creating virtual environments, it is important to create a simple directory structure in which you can organise your projects and associated files. We will use Homebrew to install pyenv, pyenv-virtualenv and pipX, however it is very likely that Homebrew will become your package manager of choice for many more tools you will require in the future. Homebrew is a package manager for Mac that lets you easily install and manage free and open source software application and tools directly from the terminal window. Simply open the terminal, enter the following command and follow the on screen instructions that will be presented in a series of pop up windows: xcode-select -install These can be obtained by directly installing a sub-set of tools contained within Apple’s Xcode developer application. Whilst your Mac already has a wide range of useful commands and tools that can be used by the Command Line Interface to direct the activities of your computer, in order to complete our Python set up these need to be enhanced with some developer specific tools. This is not intended to be a full tutorial explaining all of the features that each of these tools has to offer, instead it will simply explain how to install each tool and how you can use them to isolate your learning and subsequent project environments.īefore installing some Python specific tools, you will first need to to give your Mac the tools it needs to help create and manage the Python environment. ![]() use pipX for installing CLI based tools and packages for use across all directories and virtual environments.use pyenv-virtualenv for creating virtual environments and providing isolation for learning and project directories /repositories.use pyenv for installing and managing Python versions.The following steps relate to my setup on a MacBook Pro running macOS Big Sur with the default zsh shell. In this article I intend to walk you through my current Python development environment and lay out the steps that will allow you to replicate it. ![]() The importance of setting up a suitable Python environment that enables you to effectively manage multiple installs of different Python versions and to isolate all packages / libraries and their associated dependencies away from your global system and user environments is certainly something that should not be underestimated.
0 Comments
Leave a Reply. |