3 Antworten
+ 3
You can import the python builtin packages.
And if you want to import other 3rd party packages you need to install them first .
Type these lines at the top of script .
packages_name=["package1", "package2"]
import sys
import subprocess
subprocess.check_call(["sys.executable", "-m", "pip", "-q", "--disable-pip-version-check", "install", *packages_name])
These packages will be installed only when you run the script and will be removed later on after you exit .
+ 1
Try importing, if it don't work you only have one other option
0
Ok for example phoneNumber package I have to install or simply import