Skip to content

Commit 084b61d

Browse files
authored
Merge pull request #36 from dada-dudu/patch-2
Updated Python script to list all Python packages
2 parents 57064f3 + 7218b07 commit 084b61d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

docs/scripts/python/common_questions.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,14 @@
7171
This list is not exhaustive. For a complete, up-to-date list of available third-party packages, you can run the following Python script in your SeaTable environment:
7272

7373
```python
74-
import pkg_resources
74+
import importlib.metadata
7575

76-
installed_packages = pkg_resources.working_set
77-
packages_list = sorted([f"{i.key}=={i.version}" for i in installed_packages])
76+
# List all installed packages
77+
installed_packages = importlib.metadata.distributions()
7878

79-
for package in packages_list:
80-
print(package)
79+
# Print package names
80+
for package in installed_packages:
81+
print(package.metadata['Name'])
8182
```
8283

8384
??? question "Install and use custom python libraries"

0 commit comments

Comments
 (0)