Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to choose python 3.5.1 executable for project on Xcode 7?

I want to set up a python 3 project in Xcode, but I fail in the step where I'm asked to choose an executable for the scheme. See step 16 in the answer to Python in Xcode 4+?.

I use "which python3" to locate the executable:

$ which python3
/usr/local/bin/python3

but Xcode does not let me choose python3 from "/usr/local/bin" by clicking on it:

enter image description here

If I try following the suggestion of trojanfoe below to uncover the symbolic link through: ls -l /usr/local/bin/python3 I get to "../Cellar/python3/3.5.1/bin/python3" which in turn is a symbolic link pointing to "../Frameworks/Python.framework/Versions/3.5/bin/python3" which finally points at "Python3.5" in that directory. However, my Xcode also is not willing to let me select this file:

enter image description here

I'm running Xcode 7.3.1 in OS X 10.11.4. I've installed python 3.5.1 with home-brew.

like image 521
Noyer282 Avatar asked May 12 '16 09:05

Noyer282


2 Answers

In the file selection window right-click on python3.5 and select quick look. Close the quick look window and python3.5 will become selectable. (images attached show workflow referencing the newer python3.6 - it is the same for all python releases).

Right click on python executable

Pop up window will be shown

Select quicklook

Python executable has been selectable and "choose" button is clickable

like image 171
marken Avatar answered Oct 24 '22 06:10

marken


I just finished wrestling with this for about three hours. Okay, short answer (which marken, above, deserves credit for): Just right-click the dimmed out python3 executable, then click "Quick Look", then hit the space bar to exit the quick-look, and notice the executable is now selected, and just hit enter, or click "Choose". I have the following explanation to offer. The reason for our ability to see--but not to select--the python3 executable is that Homebrew uses a file alias, /usr/local/bin/python3, which brew's installation is given restricted permissions that Xcode is unable to pre-select, for reasons I am unsure of. (You might notice you can tediously select the executable at each and every runtime.) The alias points, in my case, to the Homebrew "Cellar"; for your reference, using the Terminal app to execute,ls -al /usr/local/bin/python3 reveals that my it's aliased to the true Homebrew python3 executable located at /usr/local/Cellar/python3/3.5.2_3/bin/(python3).

like image 34
Levi Maes Avatar answered Oct 24 '22 08:10

Levi Maes