![]() ![]() I didn’t create a new conda environment because I only use one, which is the base environment. Python Interpreter Path in VS Code Settingįrom now on, whenever we run python in VS Code, it will also use the python version in Anaconda to execute the scripts. You may need to close the existing Terminal window to ensure it takes effect. We can check the python version again in a new Terminal app window. Once Anaconda is installed, it should automatically set the path for us. Simply download Anaconda on its official website and choose the version that matches your operating system. In short, it basically comes with everything you need to get started with data analysis in python. When we install Anaconda, it also installs python and many popular packages and tools for data science and scientific computing. Now you may ask why we need to install another python, if macOS already has it pre-installed? The reason is that we need to set up a virtual environment for python, and we also need a package manager to maintain all of our python libraries such as numpy.Īnaconda does a great job on this. % which python /usr/bin/python3 % python -version Python 3.9.6Īs it shows, the default path is /usr/bin/python3 and it’s the python 3 version. Open the Terminal app and enter code as below. We can start by checking the existing python version. The good news is that, since macOS Monterey 12.3 Apple have removed python 2.7 (finally!) and have the python 3 by default. Which python?īefore OS Monterey, macOS comes with the outdated python 2.7 pre-installed, which doesn’t help anybody who are keeping the trend of python 3. It is also an excellent package manager for installing and updating python packages. Anaconda automatically updates the default python for us, and everything is ready to go. If you are like me, who just want to have a clean python environment without having to tweak the path here and there, I suggest installing python through Anaconda. Unfortunately, this appears at the top of Google search results when you search “install python on mac”, most likely because brew is an all-in-one package manager that also includes other utility packages for macOS. This is a lesson I learned from my early days as a beginner: it is harder to manage the environment in brew, and I still need to use other python package managers such as pip, which can get messy very quickly, usually ending up with more than one version in each manager. Homebrew: buyer bewareįirst of all, I do not recommend using brew to install python if you are just starting out. Since then, things have changed a lot therefore I’m writing this article to replace the old blog post for macOS Monterey 12.3 and later. ARM-based Mac, or Apple Silicon, comes with the powerful M1/M2 chip. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |