This post is the one for you if you are ready to start your programming journey with Python, and want to set up a Python environment in your Mac or PC. Python has become so popular that it has made its contributions to all kinds of applications.
The Options
There are a plenty of ways in which we gain access to Python, either locally or remotely, either in your own computer or via a cloud service provider, and even in Web-based IDEs from online learning web sites, etc.
For instance,
To obtain first sight of Python, Web-based IDEs provides a carefree option where you can do simple scripting without installing anything locally, such as
- repl.it where registered users work within an interactive window with tree view of resources, editing and output areas.
- datacamp is the one for doing data science with R and Python.
- Besides, W3Schools includes great reference to syntax, data types and basic programming structures for most languages.
Download an official installer from python.org and install multiple versions in your computer. A Python installation with a code editor together is one option which you should give it a try. Choosing a code edit or an IDE depends on personal preference. Others' fit may not be the right one for you.
- Visual Studio Code is an all-in-one editor which was initially released in 2015; with extensions, we can do most of programming languages in the Code.
- Spyder IDE is a scientific Python development environment with MATLAB-like GUI, which may be preferred by people from the fields of engineering and scientific computations.
- Visual Studio Code is an all-in-one editor which was initially released in 2015; with extensions, we can do most of programming languages in the Code.
The first two options above are straightforward and simle; but when you want to switch between multiple versions and build a project upon a specific version and package denpendencies, you should create multiple virtual environments, and associate each project with a single environment. With per-project virtual envronments, the projects are isolated from each other with respect to their dependencies, including the Python version as well as the packages.
The virtual environments are separated and updating an individual environment will not interference with others. The following options support virtual environments.
Install an environment manager such as Anaconda, the most popular Python data science platform, which comes with a bundled Python. This would be the best option if you do Python for data science, machine learning and AI. Within Anaconda, the dependency management tool Conda creates virtual environments as well as activating, deactivating and deleting the environments.
Complete option #2 and install a virtual environment management tool, such as virtualenv which creates isolated Python environments and pyenv package for isolating Python versions.
Access Python on cloud computing platforms: AWS, Microsoft Azure and GCP.
These options may easily confuse someone who just begins. No matter what options you will try or have tried previously, you would eventually find yourself ending up with managing projects with virtual environments and associating each project with one Python virtual environment. In the long run, working with Python virtual environments is the right thing to do.
If you are a beginner, before moving towards to more advanced options, such as #3, #4 and #5 listed above, I would recommend you to try both options #1 and #2.
Do not underestimate option #1. Indeed, web-based IDEs give us an ad hoc solution whenever you have no access to programming environment. Not only for Python, but also for most of the languages, repl.it allows us to easily learn and test code. Sometimes option #1 could even be sufficient for someone who is taking basic programming class.
For someone who is serious about learning programming with Python, going through Option #2, install Python and remove Python in a computer, helps understanding the structure of files and libraries in a Python installation. This is what this post is purposed to.
The following shows how to remove an old Python and install a fresh one in a computer. The first part is for MacoS and the second is for Windows. For Linux, it is similar to MacOS, but some commands are different from MacOS.
=== MacOS ===
The following video is a step-by-step demo for both install and uninstall Python in Mac.
=== Windows ===
The following video is a step-by-step demo for both install and uninstall:
To set up a Python environment for doing Data Science, refer to the video below:
Share this post
Twitter
Facebook
LinkedIn
Email