timmy / 檢查 Python 套件是否已安裝
0 j'aimes
0 forks
1 fichiers
Dernière activité 10 months ago
這段程式碼用於檢查 Python 環境中是否安裝了 numpy 模組。 如果 numpy 已安裝,則輸出 "numpy is installed",否則輸出 "numpy is not installed"。
| 1 | from importlib.util import find_spec |
| 2 | |
| 3 | if find_spec("numpy") is not None: |
| 4 | print("numpy is installed") |
| 5 | else: |
| 6 | print("numpy is not installed") |
Plus récent
Plus ancien