-->

phyton3 pip and pyautogui install mac -remove brok

2019-07-20 16:00发布

问题:

having jumped into java development a year ago, i now struggle myself thru terminal commands and try to get the red line in it.

I now want to set up python3 and pyautogui following this tutorial: https://automatetheboringstuff.com/chapter18/

unfortunately I keep failing setting up the needed module:

Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-ct_f0rph/pyobjc-core

if you please could help me out removing old python installations, and linking python command to python3 i´d be very happy :)

thanks a lot!

EDIT: my problem was due to missing xcode, installing it and agreeing license made it work with below answer

still had a problem after installing pip, here is the solve for all who still get problems:

download recommended file and run the setup inside, had to punch in many commands to run it from appropiate directory but it finally works when importing pyautogui:

https://www.reddit.com/r/learnpython/related/3z5h0b/trouble_importing_pyautogui_os_x/

ps: i only downloaded the tar ball and used the setup.py inside

回答1:

Download proper installer of python 3: Python3

Install Xcode (get it from Xcode) if you don't have it yet.

Point xcode-select to the Xcode Developer directory using the following command:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Open command line and navigate to python3 directory:

/Library/Frameworks/Python.framework/Versions/3.5/bin

Run:

sudo pip3 install pyobjc-framework-Quartz
sudo pip3 install pyobjc-core
sudo pip3 install pyobjc
pip3 install pyautogui

Try your installation from the command line, type:

python3
import pyautogui

If everything is fine you won't have an import error. I hope it helps.