沒有名為「pandas」的模組我正在JMP 18中運行一個使用 Python 的 JSL 腳本。在 macOS 上一切正常,但在 Windows 上卻出現以下錯誤:
Traceback (most recent call last):
File "
", line 7, in
ModuleNotFoundError: No module named 'pandas'
In the embedded log is see following:
Creating: C:\\Users\\Admin\\AppData\\Roaming\\JMP\\JMP\\Python\\Python311\\site-packages
This tells me that JMP 18 doesn't install python automatically. Is there a pre-requisite for python be installed?
I am also trying to install this way to ensure the script doesn't fail irrespective of the system:
Python Submit("
import jmputils
required_packages = ['pandas', 'numpy']
# get list of installed python packages
installed = jmputils.jpip('list')
# check & install missing packages
for pkg in required_packages:
if pkg.lower() not in [p.lower() for p in installed]:
print(f'{pkg} not installed — installing...')
jmputils.jpip('install', pkg)
else:
print(f'{pkg} is already installed.')
jmputils.jpip('list')
");
自動化和腳本編寫回覆:找不到名為「pandas」的模組據我所知,在 JMP18 中,該資料夾會在 Python 首次「運行」時添加,您或許可以透過執行類似以下命令來強制添加:
Python Submit("import jmp");
在 JMP 腳本編輯器中
回覆:找不到名為「pandas」的模組Python 報錯資訊正好說明 Python 已經安裝了 
若要從 JSL 安裝 Python 套件,請使用:
Python Install Packages( "numpy pandas" );

回覆:找不到名為「pandas」的模組謝謝,是的,它創建了 Python 目錄和一些軟體包。如下:
Python Submit("
import jmputils
required = ['pandas', 'numpy']
# Get installed packages safely
installed = jmputils.jpip('list')
if installed is None:
installed = []
print('Installed packages:', installed)
# Install missing ones
for pkg in required:
if pkg.lower() not in [p.lower() for p in installed]:
print(f'{pkg} not installed — installing...')
jmputils.jpip('install', pkg)
else:
print(f'{pkg} already installed.')
import pandas as pd
import numpy as np
print('pandas and numpy imported successfully!')
");
回覆:找不到名為「pandas」的模組是的,這確實幫助我確保資料夾被添加進去了。謝謝。
回覆:找不到名為「pandas」的模組使用該導入是我們在 JMP-Python 應用程式中使用的檢查方法之一,以確保一切都已設定完畢。
由於諸多原因,我仍然沒有使用 JMP19,但它確實能讓 JMP 與 Python 的整合更加便利。如果我沒記錯的話,JMP19 中整合 Python 就不再需要了,但我還沒驗證過。此外,JMP19 也會讓檢查軟體包是否已安裝變得更加容易,因為 jmputils 新增了 `is_installed` 方法。
回覆:找不到名為「pandas」的模組在 JMP 18 中,解壓縮 site-packages.zip 檔案並建立目錄是由 jsite.py 腳本完成的。 JMP 19 在首次啟動 Python 時,會在內部使用 C++ 程式碼執行此操作。 jsite.py 腳本仍然存在,作為備份,用於在 Python 的 Create JPIP CMD() 函數產生命令列 jpip.bat 或 jpip shell 腳本時使用。或者,也可以使用其 Python 等效函數 jmputils.create_jpip( dest_path )。
JMP 19 透過新增 `jmputils.is_installed('package_name')`、`jmputils.package_version('package_name')` 和 `pkg_dict = jmputils.packages()` 改進了可腳本化的套件管理。這些功能是 19.0 版本後期添加的,雖然存在,但腳本索引中沒有相關文件。後續版本在腳本索引中提供了範例。