Ways to invoke python and Spyder on OSX

前端 未结 8 1908
深忆病人
深忆病人 2020-12-07 10:00

I recently bought a MacBook and install Python on it via Anaconda. Here\'s the version information:

Python 2.7.6 |Anaconda 1.8.0 (x86_64)| (default, Nov 11 2         


        
8条回答
  •  甜味超标
    2020-12-07 10:38

    To make spyder callable from Spotlight or Finder:

    1. Locate where your spyder executable is by running in Terminal:

      which spyder
      

      This should yield ~/anaconda/bin/spyder if you installed spyder via Anaconda, /opt/local/bin/spyder if you used MacPorts or something similar.

    2. Create a file called spyder in your Applications directory and make it executable. Then, fill it with the output of the previous command, followed by a &; exit:

      touch /Applications/spyder
      chmod +x /Applications/spyder
      echo -e '#!/bin/bash'"\n~/anaconda/bin/spyder &\nexit" >> /Applications/spyder
      

      (if you use a different shell (e.g. tcsh), replace bash by that)

    3. Under Terminal -> Preferences -> Profiles -> "default profile" -> Shell -> When the shell exits: Select "Close if the shell exited cleanly"

    Optional:

    1. Download the spyder Icon from here and open it in Preview. Copy its contents by hitting cmd+C.

    2. In Finder, locate /Applications/spyder and open its "Get Info" pane by hitting cmd+I. Select the icon in the top left corner with your mouse and hit cmd+V.

提交回复
热议问题