Hướng dẫn python not found macos
Mac OS X comes with Python 2.7 out of the box. You do not need to install or configure anything else to use Python 2. These instructions document the installation of Python 3. The version of Python that ships with OS X is great for learning, but it’s not good for development. The version shipped with OS X may be out of date from the official current Python release, which is considered the stable production version. Doing it Right¶Let’s install a real version of Python. Before installing Python, you’ll need to install GCC. GCC can be obtained by downloading Xcode, the smaller Command Line Tools (must have an Apple account) or the even smaller OSX-GCC-Installer package. Note If you already have Xcode installed, do not install OSX-GCC-Installer. In combination, the software can cause issues that are difficult to diagnose. Note If you perform a fresh install of Xcode, you will also need to add the commandline tools by running While OS X comes with a large number of Unix utilities, those familiar with Linux systems will notice one key component missing: a package manager. Homebrew fills this void. To install Homebrew, open $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" The script will explain what changes it will make and prompt you before the installation begins. Once you’ve installed Homebrew, insert the Homebrew
directory at the top of your export PATH="/usr/local/opt/python/libexec/bin:$PATH"
If you have OS X 10.12 (Sierra) or older use this line instead export PATH=/usr/local/bin:/usr/local/sbin:$PATH
Now, we can install Python 3: This will take a minute or two. Pip¶Homebrew installs Working with Python 3¶At this point, you have the system Python 2.7 available, potentially the Homebrew version of Python 2 installed, and the Homebrew version of Python 3 as well. will launch the Homebrew-installed Python 3 interpreter. will launch the Homebrew-installed Python 2 interpreter (if any). will launch the Homebrew-installed Python 3 interpreter. If the Homebrew version of Python 2 is installed then The rest of the guide will assume that # Do I have a Python 3 installed? $ python --version Python 3.7.1 # Success! Pipenv & Virtual Environments¶The next step is to install Pipenv, so you can install dependencies and manage virtual environments. A Virtual Environment is a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them. It solves the “Project X depends on version 1.x but, Project Y needs 4.x” dilemma, and keeps your global site-packages directory clean and manageable. For example, you can work on a project which requires Django 1.10 while also maintaining a project which requires Django 1.8. So, onward! To the Pipenv & Virtual Environments docs! This page is a remixed version of another guide, which is available under the same license. Since I got the macOS v12.3 (Monterey) update (not sure it's related though), I have been getting this error when I try to run my Python code in the terminal: I am using Python 3.10.3, Atom IDE, and run the code in the terminal via atom-python-run package (which used to work perfectly fine). The settings for the package go like this: The I gather the error occurs because the terminal calls for
asked Mar 23 at 18:02
1 Anyone updating their macOS to Monterey 12.3 will find that they suddenly no longer have the system-provided Python 2. The reason for this is that Apple removed the system-provided Python 2 installation (details). So a workaround/solution for this is to use pyenv to install Python 2.7 (or any other specific version you need).
answered Mar 29 at 6:30
Bernd KamplBernd Kampl 2,7024 gold badges19 silver badges25 bronze badges 8 OK, after a couple of days trying, this is what has worked for me:
Problem solved. As
far as I get it, there is no more pre-installed python 2.x in macOS as of 12.3 hence the error. I still find it odd though that answered Mar 25 at 17:46
KigKig 1,2651 gold badge3 silver badges13 bronze badges 2 If you simply installed Python 3, just use But still after using pynev to install Python 2.7.18 and setting it as a global version using What worked for me (since I already had Python 3 installed) was by changing my command to use
answered Apr 13 at 4:32
AlvinAlvin 3891 silver badge7 bronze badges 4 I installed Python then this error occurred and I just run
and I t worked.on macOS Monterey 12.4, Python 3.8.9 answered Jul 10 at 16:57
1 Since you installed python3.9> (https://python.org/downloads/) , you just need to run everything with answered Aug 3 at 14:51
3 you should try
that solve my problem:) answered Jul 24 at 4:17
I got I solved it by configuring the ENVIRONMENT. I added a line, My macOS (Apple silicon):
answered Apr 5 at 4:41
CheverJohnCheverJohn 251 silver badge6 bronze badges 2 alias python=/usr/bin/python3 This command works but need to re-enter whenever we restart the termian answered Aug 27 at 19:00
I just had this problem on a new Macbook Pro with macOS Monterey, and the below worked for me using Homebrew. I don't think aliasing is necessary, or at least it doesn't seem like that when using Pyenv.
Now, the output looks like this:
If some scripts still fail, you will want to check that you added Pyenv to all the necessary shell startup files as mentioned in step 3 above. answered 1 hour ago
I have a MacBook Pro with an Apple M1 chip and macOS v12.4 (Monterey).
It seems to now be there OK.
answered Jun 20 at 21:02
StuartStuart 1717 bronze badges I use brew install If you install it successfully, please check in the
terminal. It will show you if you got problem in install if not problem you just change command from
Adriaan 17.5k7 gold badges37 silver badges71 bronze badges answered Jul 21 at 8:26
1 Try the command answered Sep 15 at 4:41
|