久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 OSX 上調(diào)用 python 和 Spyder 的方法

Ways to invoke python and Spyder on OSX(在 OSX 上調(diào)用 python 和 Spyder 的方法)
本文介紹了在 OSX 上調(diào)用 python 和 Spyder 的方法的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我最近購買了一臺(tái) 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:

  1. 無需通過啟動(dòng)器應(yīng)用程序即可啟動(dòng) Spyder(例如,通過在 Spotlight 和 Quicksilver 中輸入內(nèi)容)
  2. 從 Finder 運(yùn)行 Python 代碼,大概是通過雙擊我的 .py 文件或選擇并按下 Cmd-O 來實(shí)現(xiàn)
  3. 通過在 Quicksilver 中輸入 Python 腳本的名稱來運(yùn)行 Python 代碼(就像它是一個(gè)常規(guī)程序一樣)

這是我嘗試過的:

  1. (什么都沒有;這里沒有想法)
  2. 我已將 .py 文件與/Users/kuzzooroo/anaconda/python.app/Contents/MacOS/python 相關(guān)聯(lián)并使其可執(zhí)行(chmod u+x).當(dāng)我嘗試運(yùn)行應(yīng)用程序時(shí),它永遠(yuǎn)不會(huì)啟動(dòng),并且我沒有收到錯(cuò)誤消息(不知道在哪里查看)
  3. 使文件可執(zhí)行并嘗試從 Spotlight 運(yùn)行它們.結(jié)果與 #2 相同.

這是我可以做的:

  • 如果我在頂部有正確的 shebang 并且已使文件可執(zhí)行,則從終端窗口運(yùn)行我的代碼
  • 使用 py2app 生成應(yīng)用程序.不幸的是,這種方法存在以下缺點(diǎn):
    • 我經(jīng)常修改我的腳本,不希望每次都運(yùn)行 py2app
    • 即使是一個(gè)簡單的腳本,生成的應(yīng)用程序也是 7 MB
    • 要在某些情況下運(yùn)行應(yīng)用程序,我必須在包中四處尋找實(shí)際的Unix 可執(zhí)行文件"并運(yùn)行它

    一旦我有這個(gè)工作,我有興趣做以下事情:
    A. 控制哪些腳本在運(yùn)行時(shí)創(chuàng)建控制臺(tái)窗口,哪些不創(chuàng)建
    B. 控制生成的控制臺(tái)窗口在腳本完成時(shí)是否消失或等待用戶(我)關(guān)閉它
    但是,我懷疑一旦我首先弄清楚我將如何調(diào)用我的腳本,就很容易弄清楚如何執(zhí)行這些操作(或者是否可能).

    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 中調(diào)用:

    To make spyder callable from Spotlight or Finder:

    1. 通過在終端中運(yùn)行來定位您的 spyder 可執(zhí)行文件所在的位置:

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

    which spyder
    

    如果你通過 Anaconda 安裝了 spyder,這應(yīng)該產(chǎn)生 ~/anaconda/bin/spyder,如果你使用 MacPorts 或類似的東西,則產(chǎn)生 /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 目錄中創(chuàng)建一個(gè)名為 spyder 的文件并使其可執(zhí)行.然后,用上一個(gè)命令的輸出填充它,然后是 &;退出:

    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),用那個(gè)替換 bash)

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

    在終端->首選項(xiàng)->配置文件->默認(rèn)配置文件"->外殼->當(dāng)外殼退出時(shí):選擇如果外殼干凈退出則關(guān)閉"

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

    可選:

    1. 從這里下載spyder圖標(biāo)并打開在預(yù)覽中.按 cmd+C 復(fù)制其內(nèi)容.

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

    在 Finder 中,找到 /Applications/spyder 并按 cmd+I 打開其獲取信息"窗格.用鼠標(biāo)選擇左上角的圖標(biāo),然后按 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.

    這篇關(guān)于在 OSX 上調(diào)用 python 和 Spyder 的方法的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

    【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to install Selenium in a conda environment?(如何在 conda 環(huán)境中安裝 Selenium?)
get the CUDA and CUDNN version on windows with Anaconda installe(使用 Anaconda installe 在 Windows 上獲取 CUDA 和 CUDNN 版本)
How can I download Anaconda for python 3.6(如何下載適用于 python 3.6 的 Anaconda)
Using two different Python Distributions(使用兩個(gè)不同的 Python 發(fā)行版)
How can I install Anaconda aside an existing pyenv installation on OSX?(除了 OSX 上現(xiàn)有的 pyenv 安裝之外,如何安裝 Anaconda?)
Permanently set Python path for Anaconda within Cygwin(在 Cygwin 中為 Anaconda 永久設(shè)置 Python 路徑)
主站蜘蛛池模板: 免费视频中文字幕 | 色视频在线播放 | 一级欧美日韩 | 中文字幕1区 | 欧美精品一区在线观看 | 精品国产一区二区三区观看不卡 | 亚欧精品一区 | 精品久久久久久久久久久下田 | 国产成人精品网站 | 在线观看亚洲专区 | 欧美国产精品一区二区三区 | 精品国产一区一区二区三亚瑟 | 国产色网 | 亚洲激情综合 | www.日日夜夜 | 精品一级 | 成人二区三区 | 免费在线黄色av | 国产亚洲欧美日韩精品一区二区三区 | 日本一区二区三区在线观看 | 免费久久久| 国产精品久久久久久网站 | 男女黄网站 | 欧美精品乱码99久久影院 | 成年人在线观看视频 | 亚洲视频中文字幕 | 国精产品一区二区三区 | 日韩一区二区在线观看视频 | 97视频在线免费 | 国产精品99久久久久久动医院 | 欧美一区二区在线免费观看 | 91免费观看国产 | 久久国产一区二区三区 | 中文一区二区视频 | 亚洲二区在线 | 国产精品美女久久久久aⅴ国产馆 | 欧美精品久久久久久久久老牛影院 | 羞羞的视频在线 | 天啪 | 国产一区免费 | 日日摸日日碰夜夜爽2015电影 |