我最近购买了一台 MacBook,并通过 Anaconda 在其上安装了 Python.这是版本信息:
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 2013, 10:49:09)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
我希望能够做以下所有事情:
I'd like to be able do all of the following:
这是我尝试过的:
这是我可以做的:
一旦我有这个工作,我有兴趣做以下事情:
A. 控制哪些脚本在运行时创建控制台窗口,哪些不创建
B. 控制生成的控制台窗口在脚本完成时是否消失或等待用户(我)关闭它
但是,我怀疑一旦我首先弄清楚我将如何调用我的脚本,就很容易弄清楚如何执行这些操作(或者是否可能).
Once I have this working, I'm interested in doing the following:
A. Controlling which scripts create a console window when they run and which do not
B. Controlling whether the resulting console window disappears when the script completes or waits around for the user (me) to close it
However, I suspect it may be easy to figure out how to do these (or whether it's possible) once I've figured out how I'm going to invoke my scripts in the first place.
使 spyder 可以从 Spotlight 或 Finder 中调用:
To make spyder callable from Spotlight or Finder:
通过在终端中运行来定位您的 spyder 可执行文件所在的位置:
Locate where your spyder executable is by running in Terminal:
which spyder
如果你通过 Anaconda 安装了 spyder,这应该产生 ~/anaconda/bin/spyder
,如果你使用 MacPorts 或类似的东西,则产生 /opt/local/bin/spyder
.
This should yield ~/anaconda/bin/spyder
if you installed spyder via Anaconda, /opt/local/bin/spyder
if you used MacPorts or something similar.
在您的 Applications
目录中创建一个名为 spyder
的文件并使其可执行.然后,用上一个命令的输出填充它,然后是 &;退出
:
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'"
~/anaconda/bin/spyder &
exit" >> /Applications/spyder
(如果你使用不同的 shell(例如 tcsh
),用那个替换 bash
)
(if you use a different shell (e.g. tcsh
), replace bash
by that)
在终端->首选项->配置文件->默认配置文件"->外壳->当外壳退出时:选择如果外壳干净退出则关闭"
Under Terminal -> Preferences -> Profiles -> "default profile" -> Shell -> When the shell exits: Select "Close if the shell exited cleanly"
可选:
从这里下载spyder图标并打开在预览中.按 cmd+C 复制其内容.
Download the spyder Icon from here and open it in Preview. Copy its contents by hitting cmd+C.
在 Finder 中,找到 /Applications/spyder
并按 cmd+I 打开其获取信息"窗格.用鼠标选择左上角的图标,然后按 cmd+V.
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.
这篇关于在 OSX 上调用 python 和 Spyder 的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!