Questions tagged [python]

Python is a programming language that is included in the standard macOS installation. If you have any programming questions about Python, ask them on Stack Overflow.

Filter by
Sorted by
Tagged with
116
votes
12answers
168k 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/...
80
votes
7answers
133k 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 ...
65
votes
6answers
115k 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?
51
votes
5answers
71k 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 ...
40
votes
3answers
219k 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 ...
38
votes
3answers
108k 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 ...
30
votes
3answers
44k 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 ...
23
votes
2answers
23k 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....
22
votes
2answers
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 ...
21
votes
3answers
6k 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 ...
19
votes
5answers
36k 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 ...
17
votes
2answers
9k views

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

Is /usr/bin/python3 provided with macOS Catalina?
15
votes
4answers
24k 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 ...
14
votes
2answers
23k 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 ...
12
votes
4answers
3k 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 ...
10
votes
3answers
34k 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 ...
9
votes
2answers
9k 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 ...
9
votes
2answers
9k 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 ...
9
votes
0answers
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 ...
8
votes
3answers
9k 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....
8
votes
3answers
12k 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)...
7
votes
4answers
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/...
7
votes
1answer
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 ...
7
votes
3answers
6k 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'...
7
votes
1answer
16k 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: # ...
7
votes
1answer
106k 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 ...
7
votes
2answers
2k 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 ...
7
votes
3answers
4k 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, ...
7
votes
1answer
9k 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 ...
6
votes
1answer
7k 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 ...
6
votes
2answers
14k 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 ...
6
votes
1answer
9k 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 ...
6
votes
2answers
5k 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 ...
6
votes
1answer
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 ...
6
votes
1answer
28k 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 ...
6
votes
3answers
2k views

What are the most convenient keyboard/keyboard layout for programming?

I do a bit of Objective-C, Matlab and Python, and start to get tired of the keyboard I use (AZERTY). It is far from being optimal as one need to press ALT+SHIFT+( to get [ for example. I think of ...
6
votes
1answer
2k views

How do you upgrade/update every package on your Mac?

I want a single command to update everything on my Mac command line. No more brew update && brew upgrade && brew cleanup && brew doctor and npm update -g and that complicated ...
6
votes
0answers
7k 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 >>&...
5
votes
1answer
6k views

Deleted /usr/local/bin and /usr/bin on OS X

Guys yesterday i asked my brother to delete python 2.7 and install python 3.5 but rather than delete parts of python, he deleted all /usr/local/bin and /usr/bin. At this point /usr/bin is empty and /...
5
votes
4answers
20k views

What version(s) of Python are pre-installed on OS X 10.9 Mavericks?

In the past Python 2.6 was included with OS X 10.8. What version or versions come with 10.9 Mavericks?
5
votes
5answers
588 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 ...
5
votes
2answers
4k views

Do I need to reinstall OS X after accidentally removing Python?

I managed to delete my python in usr/bin by foolishly doing sudo rm /usr/bin/python and now it seems like I need to reinstall my OS. First off is this necessary? And secondly is there an easy way to ...
5
votes
4answers
35k views

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

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/...
5
votes
3answers
2k 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?
5
votes
1answer
2k views

How to add a Python application to OS X right-click menu?

I have made a Python-based application that plays a slideshow. I want to add shortcut on the right-click menu of a folder and play the slideshow. How can I achieve this?
5
votes
1answer
7k views

Unable to upgrade to python 3.6 from python 2.7

I'm trying to remove python 2.7 and replace it with python 3.6. The main thing I want to do is type "python" and my terminal use python 3.6, but for some reason I'm being restricted from upgrading ...
5
votes
4answers
8k views

Linking python as external build tool in Xcode 7 El Capitan

I have been using Xcode 7 as my default python editor for some time now. The usual method to run python from Xcode is given here https://stackoverflow.com/questions/5276967/python-in-xcode-7/8636301#...
5
votes
3answers
7k views

How to make an executable .py available everywhere on OS X?

I have this directory /foo/bar/. Inside, I have a python file named myfile.py. I made it executable by adding (at the top): #!/usr/bin/env python Then, I made it executable by issuing chmod +x ...
5
votes
1answer
7k views

What does Python Launcher do?

When download python from https://www.python.org/ and install it, I saw 2 apps installed, it is easy to see the purpose of IDLE but I am confused with the purpose of Python Launcher. What does Python ...
5
votes
2answers
5k views

homebrew - trouble upgrading openssl?

I'm on osx 10.11. (Background: I'm having trouble getting the system installed Python to use TLS 1.1.) From what I've read I need to use brew to manage Python. But I want to upgrade openssl first ...

1
2 3 4 5
10