-1

I want to install few packages through python, i wrote the following code

def install_dependencies():
        pip_install("colorama")
        pip_install("console-menu")

install_dependencies()

When i run this, i am getting the following error:

NameError: name 'pip_install' is not defined

What is the package name available for pip_install

md.jamal
  • 4,067
  • 8
  • 45
  • 108
  • 1
    You are calling the `pip_install()` function, but you have not defined that function locally nor imported it from anywhere, so of course it is an unknown function name. – John Gordon Mar 05 '20 at 06:02
  • 2
    Does this answer your question? [Installing python module within code](https://stackoverflow.com/questions/12332975/installing-python-module-within-code) – null Mar 05 '20 at 06:02

1 Answers1

0

Why are you doing it like that? I don't even think you can install a python library by doing what you are doing. Why not use something like os.system???

import os

def install_dependencies():
        os.system("pip install colorama")
        os.system("pip install console-menu")

install_dependencies()

I'd honestly just do a requirements.txt that the user manually installs however. But goodluck