-1
pip install tkinter
pip install PIL
pip install openpyxl

I want with one command all of these to be installed on any PC via the command prompt or python shell.

How can I do this?

4
  • Why do you want that? Are you perhaps planning to package an app for easy distribution? If so, look at e.g. PyInstaller. Commented May 3, 2021 at 8:01
  • 1
    Does this answer your question? How to install multiple python packages at once using pip Commented May 3, 2021 at 8:02
  • 3
    You cannot install tkinter using pip. Commented May 3, 2021 at 8:03
  • when you say PC, do you mean any OS? Commented May 3, 2021 at 8:08

1 Answer 1

1

You would just do:

pip install tkinter PIL openpyxl

except that - as acw1668 points out - you cannot install tkinter using pip. So that would then be:

pip install PIL openpyxl

Or you can put them, one per line, in a file called requirements.txt and execute:

pip install -r requirements.txt

As mentioned by Ceres, you can use the following to put currently-installed packages into the file:

pip freeze > requirements.txt

To install from the python prompt, take a look at Installing python module within code

You're still left with the problem of how to install tkinter. Instructions for several different OSs are here: Install tkinter for Python

You could combine the answers and use a subprocess to install python-tk from within python.

PS Consider pillow over PIL:

pip install Pillow
Sign up to request clarification or add additional context in comments.

1 Comment

You can use pip freeze > requirements.txt to get all installed packages into the file

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.