---
title: MinitabのボタンでPythonスクリプトを素早く実行 Quickly Run a Python Script with a Button in Minitab
description: Minitabの新しいPython統合機能と、Minitabインターフェースのボタンを使用してカスタムPythonコードを簡単に実行する方法について説明します。
image: https://blog.minitab.com/hubfs/B2BML%20-%20NEW%20FILE%20MANAGER%20STRUCTURE/Blog%20Images/Imported_Blog_Media/python-script-screenshot-Jul-05-2025-10-39-36-9762-PM.png
---

日本語

- [English](https://blog.minitab.com/en/?hsLang=ja)
- [Français](https://blog.minitab.com/fr/?hsLang=ja)
- [Deutsch](https://blog.minitab.com/de/?hsLang=ja)
- [Português](https://blog.minitab.com/pt/?hsLang=ja)
- [Español](https://blog.minitab.com/es/?hsLang=ja)
- [日本語](https://blog.minitab.com/ja/?hsLang=ja)
- [한국어](https://blog.minitab.com/ko/?hsLang=ja)
- [中文（简体）](https://blog.minitab.com/zh/?hsLang=ja)

- [日本語](https://blog.minitab.com/ja/blog/quickly-run-python-script-button-minitab)
- [English](https://blog.minitab.com/en/blog/quickly-run-python-script-button-minitab)
- [한국어](https://blog.minitab.com/ko/blog/quickly-run-python-script-button-minitab)

- [![Icon Partners](https://blog.minitab.com/hubfs/WCM/Partners.png) パートナー](https://www.minitab.com/ja-jp/company/partners/)
- [![Icon Contact](https://blog.minitab.com/hubfs/WCM/Contact.png) お問い合わせ窓口](https://www.minitab.com/ja-jp/company/contact-us/)
- [![Icon Talk to Minitab](https://blog.minitab.com/hubfs/WCM/Phone.png) Minitabと話す](https://www.minitab.com/ja-jp/talk-to-minitab/)
- [![Icon My Account](https://blog.minitab.com/hubfs/WCM/MyAcct.png) マイ アカウント](https://licensing.minitab.com/account/manage)

[![Minitab](https://blog.minitab.com/hubfs/WCM/minitab-corp-logo.svg)](https://www.minitab.com/ja-jp/)

- 製品
  
  戻る
  
  [製品](https://www.minitab.com/ja-jp/products/)
  
  [すべての製品](https://www.minitab.com/ja-jp/products/) 
    - [Minitab Solution Center](https://www.minitab.com/ja-jp/products/minitab-solution-center/)
    - [Minitab Statistical Software](https://www.minitab.com/ja-jp/products/minitab/)
    - [Minitab Connect](https://www.minitab.com/ja-jp/products/connect/)
    - [Minitab Model Ops](https://www.minitab.com/ja-jp/products/model-ops/)
    - [Minitab Education Hub](https://www.minitab.com/ja-jp/products/education-hub/)
    - [Minitab Engage](https://www.minitab.com/ja-jp/products/engage/)
    - [Minitab Workspace](https://www.minitab.com/ja-jp/products/workspace/)
    - [Real-Time SPC](https://www.minitab.com/ja-jp/products/real-time-spc/)
    - [Prolinkデータ収集およびSPC](https://info.minitab.com/ja/shop-floor-connectivity-with-prolink?hsLang=ja)
    - [Simul8離散事象シミュレーション](https://info.minitab.com/ja/new-to-simul8?hsLang=ja)
    - [SPM](https://www.minitab.com/ja-jp/products/spm/)
- ソリューション
  
  戻る
  
  [ソリューション](https://www.minitab.com/ja-jp/solutions/)
  
  [すべてのソリューション](https://www.minitab.com/ja-jp/solutions/) 
    - [分析](https://www.minitab.com/ja-jp/solutions/analytics/)
    - [統計・予測分析](https://www.minitab.com/ja-jp/solutions/analytics/statistical-analysis-predictive-analytics/)
    - [データ科学・機械学習](https://www.minitab.com/ja-jp/solutions/analytics/data-science-machine-learning/)
    - [ビジネス分析・インテリジェンス](https://www.minitab.com/ja-jp/solutions/analytics/business-analytics-intelligence/)
    - [統計的工程管理](https://www.minitab.com/ja-jp/solutions/analytics/statistical-process-control/)
    - [運営・品質分析](https://www.minitab.com/ja-jp/solutions/analytics/quality-analytics/)
    - [Live Analytics](https://www.minitab.com/ja-jp/solutions/analytics/live-analytics/)
    - [信頼性 & 寿命データ分析](https://www.minitab.com/ja-jp/solutions/analytics/reliability/)
    - [ディスクリートイベントシミュレーション](https://info.minitab.com/ja/new-to-simul8?hsLang=ja)
    - [プロセスマイニング](https://info.minitab.com/ja/new-to-simul8?hsLang=ja)
    - [重要な能力](https://www.minitab.com/ja-jp/solutions/key-capabilities/)
    - [継続的改善](https://www.minitab.com/ja-jp/solutions/key-capabilities/continuous-improvement/)
    - [データ統合とデータ準備](https://www.minitab.com/ja-jp/solutions/key-capabilities/data-integration-data-prep/)
    - [ダイアグラム作成とマインドマップ作成](https://www.minitab.com/ja-jp/solutions/key-capabilities/diagramming-mind-mapping/)
    - [モデル展開とML Ops](https://www.minitab.com/ja-jp/solutions/key-capabilities/model-deployment-ml-ops/)
    - [イノベーションおよびプロジェクト管理](https://www.minitab.com/ja-jp/solutions/key-capabilities/innovation-project-management/)
    - [プロセスエクセレンス：検出、修正、および防止](https://www.minitab.com/ja-jp/solutions/key-capabilities/process-excellence/)
    - [自動データ収集](https://info.minitab.com/ja/shop-floor-connectivity-with-prolink?hsLang=ja)
    - [産業ソリューション](https://www.minitab.com/ja-jp/solutions/industry/)
    - [アカデミック](https://www.minitab.com/ja-jp/solutions/industry/academic/)
    - [エネルギー・天然資源](https://www.minitab.com/ja-jp/solutions/industry/energy-resources/)
    - [政府・公共部門](https://www.minitab.com/ja-jp/solutions/industry/government/)
    - [医療](https://www.minitab.com/ja-jp/solutions/industry/healthcare/)
    - [保険](https://www.minitab.com/ja-jp/solutions/industry/insurance/)
    - [製造産業](https://www.minitab.com/ja-jp/solutions/industry/manufacturing-industrial/)
    - [サービス](https://www.minitab.com/ja-jp/solutions/industry/service-industries/)
    - [ソフトウェアとテクノロジー](https://www.minitab.com/ja-jp/solutions/industry/software-technology/)
    - [建設](https://www.minitab.com/ja-jp/solutions/industry/construction/)
    - [機能/役割](https://www.minitab.com/ja-jp/solutions/role/)
    - [エンジニアリング](https://www.minitab.com/ja-jp/solutions/role/engineering/)
    - [ビジネス分析](https://www.minitab.com/ja-jp/solutions/role/business-analysts/)
    - [情報技術](https://www.minitab.com/ja-jp/solutions/role/information-technology/)
    - [サプライチェーン](https://www.minitab.com/ja-jp/solutions/role/supply-chain/)
    - [カスタマーサービスソリューション](https://www.minitab.com/ja-jp/solutions/role/customer-service-contact-center/)
    - [人事](https://www.minitab.com/ja-jp/solutions/role/human-resources/)
    - [マーケティングデータ分析](https://www.minitab.com/ja-jp/solutions/role/marketing/)
    - [研究開発](https://www.minitab.com/ja-jp/solutions/role/research-and-development/)
- リソースとサービス
  
  戻る
  
  [リソースとサービス](https://www.minitab.com/ja-jp/resources-services/)
  
  [全リソースとサービス](https://www.minitab.com/ja-jp/resources-services/) 
    - [リソース](https://www.minitab.com/ja-jp/resources-services/resources/)
    - [ケーススタディ](https://www.minitab.com/ja-jp/resources-services/resources/case-studies/)
    - [ブログ](https://www.minitab.com/ja-jp/resources-services/resources/blog/)
    - [データセット](https://www.minitab.com/ja-jp/resources-services/resources/data-set/)
    - [ウェビナーとイベント](https://www.minitab.com/ja-jp/resources-services/resources/events/)
    - [Education Hub](https://www.minitab.com/ja-jp/resources-services/resources/education-hub/)
    - [サービス](https://www.minitab.com/ja-jp/resources-services/services/)
    - [トレーニング](https://www.minitab.com/ja-jp/resources-services/services/training/)
    - [展開](https://www.minitab.com/ja-jp/resources-services/services/deployment/)
    - [統計コンサルティング](https://www.minitab.com/ja-jp/resources-services/services/statistical-consulting/)
    - [自習型学習](https://www.minitab.com/ja-jp/resources-services/services/self-paced-learning/)
    - [社会人教育](https://www.minitab.com/ja-jp/resources-services/services/continuing-education/)
- サポート
  
  戻る
  
  [サポート](https://www.minitab.com/ja-jp/support/)
  
  [技術サポート](https://www.minitab.com/ja-jp/support/) 
    - [サブスクリプションとアクティベーション](https://www.minitab.com/ja-jp/support/subscriptions-and-activation/)
    - [Minitab Quick Start](https://www.minitab.com/ja-jp/support/quick-start/)
    - [トレーニング](https://www.minitab.com/ja-jp/resources-services/services/training/)
    - [インストールのサポート](https://www.minitab.com/ja-jp/support/installation/)
    - [サポート動画](https://www.minitab.com/ja-jp/support/videos/)
    - [ソフトウェアドキュメント](https://www.minitab.com/ja-jp/support/documents/)
    - [ソフトウェアの更新](https://www.minitab.com/ja-jp/support/software-updates/)
    - [製品のダウンロード](https://www.minitab.com/ja-jp/support/downloads/)
    - [サポートポリシー](https://www.minitab.com/ja-jp/support/policy/)
- 会社
  
  戻る
  
  [会社](https://www.minitab.com/ja-jp/company/)
  
  [会社](https://www.minitab.com/ja-jp/company/) 
    - [企業情報](https://www.minitab.com/ja-jp/company/our-company/)
    - [リーダーチーム](https://www.minitab.com/ja-jp/company/leadership-team/)
    - [パートナー](https://www.minitab.com/ja-jp/company/partners/)
    - [採用情報](https://www.minitab.com/ja-jp/company/careers/)
    - [お問い合わせ窓口](https://www.minitab.com/ja-jp/company/contact-us/)
    - [ニュース](https://www.minitab.com/ja-jp/company/press-releases/)

[試用/購入](https://www.minitab.com/ja-jp/try-buy/)

- [ブログ無料メルマガへ登録](https://info.minitab.com/ja/blog/subscribe?hsLang=ja)

![Minitab](https://20853177.fs1.hubspotusercontent-na1.net/hubfs/20853177/minitab-corp-logo.svg?t=1755011311618)

## 通知

minitab.com を終了します。

 \[続行\] をクリックして次の手順に進みます :

 続行

 戻る

# MinitabのボタンでPythonスクリプトを素早く実行 Quickly Run a Python Script with a Button in Minitab

 Minitab Blog Editor  |  7/11/2023

 トピック: [Machine Learning](https://blog.minitab.com/ja/blog/tag/machine-learning), [Minitab Statistical Software](https://blog.minitab.com/ja/blog/tag/minitab-statistical-software), [Python](https://blog.minitab.com/ja/blog/tag/python)

- [Share](https://www.linkedin.com/shareArticle?mini=true&url=https://blog.minitab.com/ja/blog/quickly-run-python-script-button-minitab)
- [Share](https://www.facebook.com/sharer.php?u=https://blog.minitab.com/ja/blog/quickly-run-python-script-button-minitab)

Minitabのインターフェイスに簡単にカスタム分析を追加する方法があればいいのに、と考えたことのある方は、ぜひこれをお読みください！Minitabの新しいPython統合機能により、MinitabインターフェイスのボタンでカスタムPythonコードを簡単に実行できるようになりました。プログラマーじゃないからと、恐れないでください！私自身もプログラマーではないので、私にできるなら、あなたもできます。

この記事では、Pythonスクリプトを実行するためのボタン付きカスタムメニューを追加する手順についてご説明します。PythonスクリプトがQQプロットを生成し、結果はMinitabの出力ペインに表示されます。

あなたがコーディングの達人であれば、この例は相当単純でしょう。でも職場の同僚たちのためにこれに似たものをごく簡単にセットアップできるんだ、そして彼らがカスタムコードを活用できるようにしてあげられるんだと実感できるはずです。英雄になれます！

## **まずは大事なことから：Pythonを起動しましょう**

この機能はMinitab 19.2020.1以降で利用できるものです。[Python 3.6.1以降がインストールされている必要があります](https://www.anaconda.com/products/individual)。MinitabをPythonに接続する方法の詳細については、[こち](https://support.minitab.com/minitab/19/python-integration/introduction/?utm_campaign=Webinar%20Wednesdays&utm_source=blog&utm_medium=python-integration-qq-plot)らをご覧ください。

QQプロットを生成するPythonスクリプトと、データをMinitabからPythonに送信して結果をMinitabに返すコマンドは、以下の通りです。

![Python script](https://blog.minitab.com/hs-fs/hubfs/B2BML%20-%20NEW%20FILE%20MANAGER%20STRUCTURE/Blog%20Images/Imported_Blog_Media/python-script-screenshot-Jul-05-2025-10-39-36-9762-PM.png?width=600&name=python-script-screenshot-Jul-05-2025-10-39-36-9762-PM.png)

上のPythonスクリプトは、[こち](https://blog.minitab.com/hubfs/Blog/QQ_plot.py?hsLang=ja)らからもダウンロードできます。私はインターネットを検索してQQプロットを生成するスクリプトを見つけました。これは、コーディングを学びたくない人にとって手っ取り早いですね。なお、上のコードはMinitabワークシートの列C1にあるQQプロットのデータを取得することに注意してください。

### **コーディングの達人ですか？**

[![More on Commands that Let Minitab 'Talk' to Python](https://no-cache.hubspot.com/cta/default/3447555/731aa4f7-2d84-4d5c-af44-831db7f47cea.png)](https://cta-redirect.hubspot.com/cta/redirect/3447555/731aa4f7-2d84-4d5c-af44-831db7f47cea)

 

## **MinitabでPythonファイルの場所を設定する**

まず、Pythonスクリプトの場所をMinitabに教えます。使用するメニューパスは \[ファイル\] > \[オプション\] です。新しいウィンドウで、スクリプトを保存したデフォルトのファイル場所を参照します。指定したフォルダでPythonスクリプトが検索されます。

## ![python-minitab-file-location-screenshot-updated](https://blog.minitab.com/hs-fs/hubfs/B2BML%20-%20NEW%20FILE%20MANAGER%20STRUCTURE/Blog%20Images/Imported_Blog_Media/python-minitab-file-location-screenshot-updated-Jul-05-2025-10-39-36-0326-PM.png?width=600&name=python-minitab-file-location-screenshot-updated-Jul-05-2025-10-39-36-0326-PM.png)

## **新しいカスタムMinitabメニューを作成する**

1. \[表示\] > \[カスタマイズ\]を選択します。
2. \[コマンド\]タブの\[カテゴリ\]リストから、\[新規メニュー\]を選択し、\[コマンド\]リストから\[新規メニュー\]を選択します。
3. \[カスタマイズ\]ダイアログボックスが開いている間に、\[新規メニュー\]をMinitabインターフェイス内の表示させたい場所までドラッグします。挿入箇所が表示されたら、マウスのボタンを放します。
   
   ![Insertion point where your new custom Minitab menu will appear](https://blog.minitab.com/hs-fs/hubfs/B2BML%20-%20NEW%20FILE%20MANAGER%20STRUCTURE/Blog%20Images/Imported_Blog_Media/python-minitab-custom-menu-insertion-point-Jul-05-2025-10-39-39-1689-PM.png?width=92&name=python-minitab-custom-menu-insertion-point-Jul-05-2025-10-39-39-1689-PM.png)
4. Minitabインターフェイスの新規メニューの場所で、\[新規メニュー\]を右クリックし、\[名前ボタン\]を選択します。カスタムメニューの名前（たとえば、Pythonスクリプト）を入力し、\[OK\]をクリックします。  
   
   
   **![python-minitab-custom-menu](https://blog.minitab.com/hs-fs/hubfs/B2BML%20-%20NEW%20FILE%20MANAGER%20STRUCTURE/Blog%20Images/Imported_Blog_Media/python-minitab-custom-menu-Jul-05-2025-10-39-38-1275-PM.png?width=586&name=python-minitab-custom-menu-Jul-05-2025-10-39-38-1275-PM.png)**
5. \[閉じる\]をクリックします。

 

読み続けていますか？素晴らしい！あともう少しです！

 

## **Pythonスクリプトを呼び出すMinitab execマクロを作成する**

次に、新しいWindowsメモ帳ファイルを開いて、以下のコマンドを入力します。

**PYSC "QQ\_plot.py"**

このPYSCコマンドは、Minitabに、Pythonを呼び出してQQプロットスクリプトを実行するよう指示します。PYSCはMinitabコマンドです。二重引用符で囲まれた値は、実行するスクリプトの名前です。

Minitab execの中にコマンドを保存するには、テキストファイルを保存し、「QQ\_Plot.MTB」という名前にします（.txtではなく必ず.MTBとして保存してください）。このファイルを、Pythonスクリプトが保存されるデフォルトのファイル場所に保存します（\[ファイル\]> \[オプション\]を使用してMinitabで設定したのと同じ場所）。

![Be sure to save the file as .MTB, not .txt](https://blog.minitab.com/hs-fs/hubfs/B2BML%20-%20NEW%20FILE%20MANAGER%20STRUCTURE/Blog%20Images/Imported_Blog_Media/python-minitab-save-mtb-Jul-05-2025-10-39-33-9207-PM.png?width=252&name=python-minitab-save-mtb-Jul-05-2025-10-39-33-9207-PM.png)

よくできました！次に、Minitab execファイルを実行するコマンドを作成します。

 

## **Minitab execファイルを実行するコマンドを作成する**

1. \[表示\] > \[カスタマイズ\]を選択します。
2. \[カスタマイズ\]ダイアログボックスで、\[ツール\]タブをクリックします。
3. \[ツール\]タブで、\[新規（挿入）\]ボタンをクリックします.![New (Insert) Button](https://blog.minitab.com/hs-fs/hubfs/B2BML%20-%20NEW%20FILE%20MANAGER%20STRUCTURE/Blog%20Images/Imported_Blog_Media/python-minitab-new-insert-button-Jul-05-2025-10-39-40-2306-PM.png?width=23&name=python-minitab-new-insert-button-Jul-05-2025-10-39-40-2306-PM.png)
4. コマンドの名前を入力します（ここではコマンドにQQ plot C1という名前を付けました。このコマンドのデータがワークシートのC1にあることを思い出せるようにするためです。）次に、Enterキーを押します。
5. \[開く\]ボタン(...)をクリックします。
6. ファイルの種類のドロップダウンリストから、\[すべて（\*.\*）\]を選択します。
7. 前に保存したexecファイル「MTB」を参照して選択します。  
   ![python-minitab-select-exec-dialog-update](https://blog.minitab.com/hs-fs/hubfs/B2BML%20-%20NEW%20FILE%20MANAGER%20STRUCTURE/Blog%20Images/Imported_Blog_Media/python-minitab-select-exec-dialog-update-Jul-05-2025-10-39-35-0095-PM.png?width=436&name=python-minitab-select-exec-dialog-update-Jul-05-2025-10-39-35-0095-PM.png)

## **最後に、マクロをカスタムメニューに追加して、Minitab/Python QQプロットを作成！**

1. \[表示\] > \[カスタマイズ\]を選択します。
2. \[カスタマイズ\]ダイアログボックスで、\[コマンド\]タブをクリックします。
3. \[カテゴリ\]リストから、カテゴリを選択します。
4. \[コマンド\]リストから、追加するコマンドを選択します。
5. \[カスタマイズ\]ダイアログボックスが開いている間に、選択したコマンドをMinitabインターフェイスのカスタムメニューまでドラッグします。
6. \[閉じる\]をクリックします。

良い感じです！もう少しお付き合いください。ゴールは目の前です。

Minitabワークシート（前述のスクリプトを使用している場合は列C1）にデータを追加した後、右側のカスタムメニュー\[Pythonスクリプト\]で作成した\[QQ Plot C1\]ボタンをクリックします。

![python-minitab-custom-menu-qq-plot-c1-1](https://blog.minitab.com/hs-fs/hubfs/B2BML%20-%20NEW%20FILE%20MANAGER%20STRUCTURE/Blog%20Images/Imported_Blog_Media/python-minitab-custom-menu-qq-plot-c1-1-Jul-05-2025-10-39-42-4077-PM.png?width=134&name=python-minitab-custom-menu-qq-plot-c1-1-Jul-05-2025-10-39-42-4077-PM.png)

MinitabによってデータがPythonに送信され、Pythonはコードを実行して、次のようなグラフをMinitab出力ペインに送り返します。

![Minitab output from Python script](https://blog.minitab.com/hs-fs/hubfs/B2BML%20-%20NEW%20FILE%20MANAGER%20STRUCTURE/Blog%20Images/Imported_Blog_Media/python-minitab-script-output-Jul-05-2025-10-39-41-3348-PM.png?width=600&name=python-minitab-script-output-Jul-05-2025-10-39-41-3348-PM.png)

その調子！Minitabの新しいPython統合機能と無料のオープンソースコードにより、コーディングの学習には特に興味はないけれど、追加機能にアクセスしたいと思っている私たちのような人にとって楽になります。

[今すぐ30日間の無料トライアルを入手してください！](https://www.minitab.com/ja-jp/products/minitab/free-trial/)

 

## おすすめのブログ

<https://blog.minitab.com/ja/blog/confidence-in-every-calculation-how-minitab-supports-fda-regulated-validation?hsLang=ja>

[あらゆる計算への信頼：MinitabがFDA規制下の検証をサポートする方法 Confidence in Every Calculation: How Minitab Supports FDA-Regulated Validation](https://blog.minitab.com/ja/blog/confidence-in-every-calculation-how-minitab-supports-fda-regulated-validation?hsLang=ja)

[Fda](https://blog.minitab.com/ja/blog/tag/fda)  | 6 分読み

<https://blog.minitab.com/ja/blog/the-future-is-now-improving-the-supply-chain-with-predictive-analytics?hsLang=ja>

[その未来は今ここに: 予測分析によるサプライチェーンの改善 The Future is Now: Improving the Supply Chain with Predictive Analytics](https://blog.minitab.com/ja/blog/the-future-is-now-improving-the-supply-chain-with-predictive-analytics?hsLang=ja)

[Data Analysis](https://blog.minitab.com/ja/blog/tag/data-analysis)  | 13 分読み

<https://blog.minitab.com/ja/blog/machine-learning-r-integration?hsLang=ja>

[機械学習とR統合でプロセスの欠陥を減らすための4つのステップ 4 Steps to Reduce Process Defects with Machine Learning and R Integration](https://blog.minitab.com/ja/blog/machine-learning-r-integration?hsLang=ja)

[Predictive Analytics](https://blog.minitab.com/ja/blog/tag/predictive-analytics)  | 18 分読み

---

- [採用情報](https://www.minitab.com/ja-jp/company/careers/)
- [信頼できる窓口](https://www.minitab.com/ja-jp/trust-center/)
- [サプライヤー](https://www.minitab.com/ja-jp/suppliers/)
- [サイトマップ](https://www.minitab.com/ja-jp/site-map/)

- [![linkedin](https://blog.minitab.com/hubfs/WCM/linkedin-1.png)](https://www.linkedin.com/company/minitab/)
- [![facebook](https://blog.minitab.com/hubfs/WCM/facebook.png)](https://www.facebook.com/Minitab/)
- [![youtube](https://blog.minitab.com/hubfs/WCM/youtube.png)](https://www.youtube.com/user/MinitabInc)
- [![instagram](https://blog.minitab.com/hubfs/WCM/instagram.png)](https://www.instagram.com/minitab/)

---

© 2025 Minitab, LLC. All Rights Reserved.

- [使用条件](https://www.minitab.com/ja-jp/legal/terms-of-use/)
- [個人情報保護方針](https://www.minitab.com/ja-jp/legal/privacy-policy/)
- [法務](https://www.minitab.com/ja-jp/legal/)

- Cookies Settings