Questions tagged [python]

General usage of any python tool and running scripts and Apple specific questions are on topic here. Detailed languag-specific questions about programming (where it won’t matter if python runs on any os) belong on Stack Overflow.

Filter by
Sorted by
Tagged with
116 votes
12 answers
170k views

How to use pip after the OS X El Capitan upgrade?

After the El Capitan update, I am unable to run pip install. The error I get is that the "operation is not permitted" when pip tries to create new folders while installing. creating /System/Library/...
web_ninja's user avatar
  • 1,263
93 votes
5 answers
229k views

How to install specific version of python on OS X

I need to install python3.4 on my OS X. Tried to do it with brew install python3 and now I have python 3.5.1. But I need py3.4. How can I install python3.4 on my Mac?
Paul's user avatar
  • 755
82 votes
7 answers
208k views

How to add permanent environment variable in zsh

I have been scouring the internet, and cannot seem to find a solution to permanently adding an environment variable, specifically when my OS is macOS Mojave (10.14). It seems there are a lot of ...
Intrastellar Explorer's user avatar
79 votes
9 answers
170k views

Homebrew: Rollback from Python 3.7 to Python 3.6.5.x?

A brew upgrade upgraded my system Python to Python 3.7. Unfortunately, Python 3.7 breaks other software I need to use (including but not limited to Ansible). I imagine these problems will be worked ...
clay's user avatar
  • 1,087
67 votes
7 answers
100k views

How to get the fully resolved path of a symbolic link in Terminal?

I have a tangled mess of python installations on my laptop. I was looking at the executables in /usr/local/bin and they are all symbolic links to ../../../Library...... There's some weird behavior ...
Robert S Ciaccio's user avatar
66 votes
3 answers
391k views

Remove and Reinstall Python on Mac -- Can I trust these old references?

I'm new to the mac, and apparently I've made some sort of error. I've been learning python, via tutorials, and between Homebrew, Pip and XCode somehow my versions are all mixed. Pip3 points to ...
zipzit's user avatar
  • 1,693
60 votes
3 answers
206k views

keeping python 3 up to date on a mac

I want Python 3 (and I do not want to mess with OS X provided python). According to: https://docs.python.org/3/using/mac.html I can get Python 3 and live long and prosper, BUT it is not clear what ...
user1256923's user avatar
  • 3,486
54 votes
3 answers
85k views

Do Terminal processes stop if Mac sleeps?

I'm running some Python machine learning programs through Terminal that take hours at a time to finish. If I leave my computer unattended it hibernates - the screen goes off and I have to type in my ...
Nicholas Hassan's user avatar
30 votes
2 answers
22k views

Is /usr/bin/python3 provided with macOS Catalina?

Is /usr/bin/python3 provided with macOS Catalina?
XDR's user avatar
  • 625
29 votes
3 answers
8k views

Prevent "<application> quit unexpectedly" message on sigquit

I kill Python processes with SIGQUIT by pressing Ctrl\ sometimes (usually my own that are misbehaving). Can I prevent the "Python quit unexpectedly" message? I know I can just hit escape, so it's not ...
Thomas's user avatar
  • 437
28 votes
2 answers
28k views

iTerm2 doesn't read com.googlecode.iterm2.plist

I am iTerm2 (1.0.0) user. I know how to create profiles, by using iTerm settings or modifying com.googlecode.iterm2.plist file. For convenience, I will use .plist to indicate com.googlecode.iterm2....
Gyuhang Shim's user avatar
27 votes
7 answers
98k views

M1 mac: mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e') - python

When I try to run "scrapy startproject" in vscode, below error comes up. Traceback (most recent call last): File "/Users/admin/Desktop/development/project/scrapyTutorial/venv/bin/...
Ryan's user avatar
  • 373
22 votes
2 answers
13k views

How to compile mod_wsgi, mod_fastcgi, etc on Mountain Lion (Mavericks) by fixing `apxs:Error: Command failed with rc=65536`?

I've updated to OS X Mountain Lion. Update has removed all of my python and apache modules including mod_wsgi. Now I'm trying to recompile mod_wsgi (it compiled without problems on Lion). I use ...
Daniil Ryzhkov's user avatar
21 votes
2 answers
18k views

How to make python 3.11 my default python3 with brew

I like new software and I noticed that 3.11 is available in brew, so I have installed it: brew install python@3.11 I can get a repl by running python3.11, but if I run python3 I still get python 3.10 ...
Rumbles's user avatar
  • 390
17 votes
3 answers
224k views

Where is my .bash_profile located? (Mac OS 10.10.5)

Disclamer: I am a newbie to UNIX programming. I downloaded Anaconda but then realized that I did not need it. I deleted and uninstalled it as fully as I could find out how. It seems that everything ...
Darcy's user avatar
  • 353
16 votes
2 answers
19k views

Restore Python 2.7 on Monterey 12.3?

The Monterey 12.3 upgrade removes Python 2.7 with no user warnings. Homebrew only knows about Python 3. What other ways are there to get Python 2 back up and running? I'm not interested in hearing ...
scruss's user avatar
  • 608
16 votes
6 answers
105k views

My Mac has Python3 and 2.7 installed. How do I uninstall Python3 but keep 2.7? [closed]

I installed python3 a few days ago, but I need to use version 2.7 for school. When I run in terminal, it shows like below: RandeMacBook-Pro:~ ranshu$ which python /Library/Frameworks/Python.framework/...
R.Samuel's user avatar
  • 161
15 votes
4 answers
25k views

What's wrong with my launchctl config?

I'm trying to auto-run SickBeard on login python /Applications/Sick-Beard/Sickbeard.py <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN ...
Joao Costa's user avatar
14 votes
5 answers
41k views

Will macOS Big Sur remove the default Python installation for good?

I initially thought that this would happen with Catalina, but since it didn't happen a similar question is again relevant: My question is two fold: When I eventually update to macOS Big Sur, will the ...
ruohola's user avatar
  • 999
14 votes
4 answers
11k views

Why is 'xattr' not working?

When I attempt to execute xattr in Terminal, I get Traceback (most recent call last): File "/usr/bin/xattr-2.7", line 33, in <module> import xattr ImportError: No module named xattr What'...
orome's user avatar
  • 11.5k
14 votes
4 answers
6k views

Using pip vs. MacPorts for installing Python packages

I could install a python package (for example, numpy) on my Mac either via Macports: port install py-numpy or via pip: pip install numpy What are the general pros/cons of each approach? When ...
jvriesem's user avatar
  • 744
12 votes
4 answers
75k views

How to install python3.7 on a mac (mojave using homebrew

I am running MacOS Mojave (10.14.6) and want to install python 3.7. Currently I have python 3.6 installed: $ python -V Python 3.6.9 There seems to be python 3.7 available: $ brew search python ==> ...
Alex's user avatar
  • 1,798
11 votes
3 answers
19k views

WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable

I'm running macOS Sierra 10.12.2 and am trying to get Python's IDLE to work properly with Tcl/Tk. This is the error message I'm getting when I open IDLE: Python 2.7.13 (default, Dec 18 2016, 07:03:39)...
Borealis's user avatar
  • 191
11 votes
2 answers
26k views

When updating to macOS Catalina will the default Python installation get removed from my system?

Apple will stop shipping scripting languages like Python with macOS starting with Catalina. When I eventually update to macOS Catalina, will the Python (2.7.X), which currently ships with macOS get ...
ruohola's user avatar
  • 999
11 votes
2 answers
16k views

Is Python Pre-Installed on Every Mac Version?

Is Python pre-installed on every mac version? If so, how far does it go? Also, I know in CentOS, its encouraged not to use the Python Pre-Installed and to actually use your own Python version (to ...
Sam's user avatar
  • 111
10 votes
3 answers
43k views

How to create a VPN connection via terminal?

I have a macbook pro with mavericks running. I am looking for a way to connect to a VPN network in terminal. The reason why I want to do this is that I want to write a small program in Python which ...
Choushishi's user avatar
10 votes
2 answers
10k views

How can I bring a window to frontmost without focusing it using Applescript in OS X 10.8

I want to bring a window (QuickTime for example) to frontmost, without focusing it. I can do it in OS X 10.7 using the following code in Applescript. tell application "System Events" set visible ...
Yuxiao Zeng's user avatar
9 votes
3 answers
3k views

How do you homebrew cleanup except to skip specified formula?

In Homebrew, to clean up outdated packages, we do brew cleanup, and currently I have about 9.5GB worth of old packages, pending for removal. However, I really do not like to remove old python ...
Antony's user avatar
  • 345
9 votes
1 answer
15k views

Using tkinter with Catalina, how to avoid deprecation warning?

I want to use the tkinter GUI library with python3 and Catalina 10.15.1, but I get a deprecation warning. % python3 Python 3.7.4 (default, Oct 26 2019, 09:13:24) >>> import tkinter >>&...
Ken Shirriff's user avatar
9 votes
0 answers
40k views

How to install command line developer tools in Yosemite? [closed]

I am trying to install xcode developer tools via this command: xcode-select --install and I have this error: "Can't install this software because it is not currently available from the Software ...
user3058197's user avatar
8 votes
3 answers
11k views

No package 'libffi' found in Homebrew Virtual Environment

I'm using a homebrew installation of python and getting an error using pip within a virtualenvwrapper environment: No package 'libffi' found Package libffi was not found in the pkg-config search path....
MikeiLL's user avatar
  • 515
8 votes
6 answers
23k views

Why do I only have pip3 but no pip?

I installed python3 from www.python.org(not thru brew). I found that I did not have pip then, only pip3. As here said https://pip.pypa.io/en/stable/installing/ pip is already installed if you are ...
Qiulang 邱朗's user avatar
8 votes
1 answer
8k views

How do I change back from MacPorts Python to system default version?

I used MacPorts to install a newer version of Python on my system (10.5.8 PPC), and then used the MacPorts select command to change the default invoked version of Python to the MP version. Now I want ...
CyberSkull's user avatar
  • 2,517
8 votes
1 answer
13k views

Command line tool for interacting with Bluetooth Low Energy devices, similar to gatttool

I've just found out that some Python code I've got working on Linux also needs to work on OSX. For reliability reasons, on Linux I've been using a cludgy but effective approach to reading and writing ...
Nikolas Skoufis's user avatar
7 votes
4 answers
10k views

Python Virtualenv is broken since upgrading to OS X Mountain Lion

Since upgrading to Mountain Lion, when running the command "virtualenv env", I get: New python executable in env/bin/python Installing setuptools......... Complete output from command /Users/...
olive's user avatar
  • 171
7 votes
4 answers
6k views

Homebrew Vim with Python support depends on Python 3.7.0, and I have to use 3.6.5

I have to use Python 3.6.5 because of a library I use that keeps showing bugs on 3.7.0 (TensorFlow). I installed Python 3.6.5 using Homebrew as follows: brew install https://raw.githubusercontent....
Adel Redjimi's user avatar
7 votes
1 answer
3k views

Using python screws up the shell (and/or terminal?)!

The problem Simply opening and closing the Python sub-shell screws up my shell (or possibly the terminal?). It seems to remove the shell's ability to print any text I enter, including newlines after ...
jvriesem's user avatar
  • 744
7 votes
4 answers
30k views

M1 mac mini: Python reports `mach-o, but wrong architecture`

We've rented a M1 Mac Mini at a Cloud provider and installed python3 via homebrew. However, when installing packages, we see many errors reporting wrong architecture mismatches. pip3 install <...
pat-s's user avatar
  • 183
7 votes
1 answer
20k views

How to set up multiple PATHs in the user bash_profile in OSX 10.8?

I am looking to set up my laptop for both Python development and Phonegap Android development in OSX 10.8 using Eclipse. I installed the lastest version of Python (3.3) which added the code: # ...
beatsforthemind's user avatar
7 votes
1 answer
28k views

The system version of Tk is deprecated [duplicate]

I installed python3 and tcl-tk with homebrew on my iMac. However, when I want to launch my program using the terminal, this message is displayed: DEPRECATION WARNING: The system version of Tk is ...
Lola's user avatar
  • 101
7 votes
3 answers
7k views

How best to isolate my development environment on OS X?

What is the current best practice for setting up a development environment on OS X? I recently got a new Mac with OS X 10.10, Yosemite. I'm familiar with homebrew, and from my Linux experience, ...
tommytwoeyes's user avatar
6 votes
5 answers
897 views

Avoid the terminal process to close, after BBEdit runs a script

I use BBEdit to write and test Python scripts, and I usually run the scripts in a terminal process, with the "Run in Terminal" command. Is there a way to have the terminal process opened by BBEdit ...
Fabio's user avatar
  • 425
6 votes
2 answers
16k views

Install and import site-packages for Python 2 and 3 on Mac

I installed brew and then brew install python brew install python3 Install flask with pip pip install flask Try python -c 'import flask' But I got exception ImportError: No module named flask ...
Frozen Flame's user avatar
6 votes
2 answers
10k views

Create Automator Service With a Python Script?

I'm trying to create an Automator Service that will act on selected text, converting dashes to spaces, and also making word caps for all the text. A friend gave me this python script (I know nothing ...
George C's user avatar
  • 495
6 votes
3 answers
3k views

Can I update to python3.7 from python2.7 in my macOS 10.14.1?

I have macOS 10.14.1. I installed Python3.7 but can see that python2.7 already installed in my os. Can I remove 2.7 and just keep 3.7? Will it affect other apps?
Kumar Gaurav's user avatar
6 votes
2 answers
6k views

iTerm2, unicode and sympy

In my both Mac (OS X Mavericks) and Ubuntu machine, I have installed sympy that is a python library for symbolic mathematics. Part of sympy is the pretty print functionality that uses unicode ...
Pouya's user avatar
  • 405
6 votes
1 answer
1k views

Installing Python 3.0 on my Mac

I'm using built-in Python 2.6.1, however, I need to run Python 3.0 from time to time. Is it OK to install Python 3.0 on my Mac? Is there anything that I need to be cautious? How about the ...
prosseek's user avatar
  • 5,614
6 votes
2 answers
6k views

How to code-sign my python script / package packaged for mac using pyinstaller without using xcode?

I have written a python script and bundled it using the PyInstaller. The executable file inside the dist folder works fine on my Mac. But not on someone else's Mac even if they've set "App Store ...
chitharthan's user avatar
6 votes
1 answer
29k views

How to remove one old python installation from a system with multiple (non-system) installations of python

Disclaimer First, let me get the obvious out of the way: I have not touched the system-bundled Python. I know it’s important to leave it alone. I have, in fact, done exactly that. ☺ Background ...
Zearin's user avatar
  • 311
6 votes
1 answer
1k views

Python Script Using Efficiency Cores Rather than Performance Cores in M1

I am using moviepy to automate clips to make a video. I am using python 3.10. When I run from pycharm, it is using performance cores to render my videos. But when I moved to crontab to schedule this ...
krishnamraju's user avatar

1
2 3 4 5
12