在離線的 Windows 環境中安裝 Python

這很重要

Azure Data Studio 將於2026年2月28日停止使用。 你應該遷移到 Visual Studio Code。 更多資訊請參見 Azure Data Studio 最新消息

本教學示範如何在離線 Windows 環境中使用筆記型電腦安裝並使用 Python 核心。

先決條件

下載 Python 與相依系統

  1. 在有網路連線的機器上,下載最新的Azure Data Studio Python套件。 將檔案解壓縮到本機目錄(例如:)。

    備註

    最新版本的Azure Data Studio Python為 3.8.10。

  2. 在終端機中,導覽到 Python 目錄。

    cd C:\azuredatastudio-python
    
  3. 建立一個含有下列內容且名為 requirements.txt 的文字檔。

    pandas>=0.24.2
    jupyter>=1.0.0
    sparkmagic>=0.12.9
    powershell-kernel>=0.1.3
    
  4. 建立名為 的子目錄。

    mkdir wheelhouse
    
  5. 執行下列命令,將必要的相依性下載到子目錄。

    python.exe -m pip download -r requirements.txt -d wheelhouse
    

備註

請檢查確保您已安裝最新的 pip 版本。 如果您不確定,您可以執行下列命令來升級它:。

在沒有網路連線的機器上安裝 Python

  1. 在沒有網路連線的機器上,將 Python 資料夾複製到本地目錄(例如:C:\azuredatastudio-python)。

  2. 在終端機中,前往 Python 資料夾。

    cd C:\azuredatastudio-python
    
  3. 執行下列命令以安裝相依性。

    python.exe -m pip install -r requirements.txt --no-index --find-links wheelhouse
    

在 Azure Data Studio 中使用已安裝的 Python

  1. Open Azure Data Studio
  2. 在指令面板中搜尋 為筆記本配置 Python
  3. 設定筆記本的 Python 向導中,選擇 使用現有的 Python 安裝,並瀏覽到已安裝的 Python 位置(例如:C:\azuredatastudio-python)。

精靈完成後,開啟新的筆記本並將核心改成 Python。