how, inside a python script can I install packages using pip? I don't use the os.system, I want to import pip and use it.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
It's not a good idea to install packages inside the python script because it requires root rights. You should ship additional modules alongside with the script you created or check if the module is installed:
If you insist in installing the package using pip inside your script you'll have to look into
call
from thesubprocess
module ("os.system()
" is deprecated).There is no pip module but you could easily create one using the method above.