You can host multiple instances of Python and easily switch between them using pyenv. I tried deleting the Python 3.8 installation folder as well, but unfortunately, it kept prevailing.ĭefeated, I turned to the internet for help where I learnt of something called as pyenv. While Python 3.9 was the main Python installation on my Mac, when I called in the “python3 –version” command within the Terminal, it would return Python 3.8 as the version that’s installed. I am yet unsure as to what was causing the issue, but this is what I think happened. However, even though I copied them inside the Python 3.9 folder within “/System/Library/Frameworks/Python,” when I typed in “python3 filename.py” in the Terminal, I was hit with the same error. When I tried importing BeautifulSoup in my code, I got hit with this error: ImportError: No module named 'bs4'Īpparently, the new version of Python that I installed from the official website also somehow installed an older version-3.8-and the libraries I downloaded were installed inside that. Here’s the command I used: pip install beautifulsoup4 Thinking I was set, I now tried installing BeautifulSoup using pip. So, I opened the good ol’ Terminal and typed this: python3 get-pip.py Prior to that, it was imperative to install pip. Now, I needed to install the BeautifulSoup library for one of my web scraping projects. I tried installing it from within VS Code itself, and it installed properly. That’s when VS Code pushed me to install Pylint, which is a source code, bug, and code quality checker for Python. Just to test it out, I wrote a simple “Hello, World” Python application and tried to save it. Once I did that, I downloaded Microsoft’s Visual Studio Code editor and set it up to work with Python. So, knowing that, I went along to download the newest version of Python-3.9.4-and installed it directly by following the instructions in the executable file. But that might open up a whole new can of worms as some functions within macOS might be dependent on these old versions of Python. Naturally, a clear course of action would be to delete the old version of Python and install the latest version from Python’s official website. The problem is it’s deprecated and is not recommended for use in new projects. There are older versions as well, but 2.7 is the latest pre-installed version. The Python version that comes pre-installed in macOS is 2.7. While you can also work with recent versions like Python 3.8, the latest version is recommended for utmost compatibility. Modern applications and libraries require the latest version of Python, which, at the time of this publication, is 3.9.4. But it isn’t so much when you’re planning on working with Python for your projects. ![]() That’s essential for utmost compatibility. Macs come with multiple versions of Python pre-installed. What I took for granted is the possibility that it would be a nightmare to install and set up Python on my Mac. I thought it would be an easy task as I’d simply install Python and then change file paths within my code to match macOS’ filesystem. We can see that Python 2 is available by default and Python 3 is not installed on macOS Catalina as shown in Fig 1.When I recently switched over from my Windows PC to an M1 MacBook Air, I realized I also needed to transfer the Python scripts I wrote for discovering and reporting news at The 8-Bit. In this step, we will check the existing Python that ships by default with macOS Catalina using the commands as shown below. We can use the command python to check the Python version which is specifically used for Python 2. ![]() The default installation of macOS Catalina ships with Python 2 by default. You might also be interested in Python Cheatsheet to learn or brush up on the basics of Python. The steps should be the same for other distributions of macOS including Sierra, High Sierra, and Mojave. Python 3.9 on the popular macOS distribution Catalina. In this tutorial, we will discuss all the steps required to install Python 3 i.e. It soon entered into mainstream programming and majorly popular among data science engineers. Python has emerged as one of the major programming languages used to develop different types of applications including Web Applications, Desktop Applications, Numeric and Scientific Applications, etc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |