Search code examples
python-3.xsetuptoolseasy-install

'easy_install' is not recognized as an internal or external command, operable program or batch file


I couldn't run easy_install, even as setuptools are already installed. By the way, I could see the easy_install.py file under the ...\Lib\site-packages\setuptools\command directory but there is no easy_install.exe file under .../Scripts directory. So the problem is not about PATH not added as there's no .exe to be found.

  • setuptools 58.0.4
  • python 3.8.8
  • Windows 10

I wonder is there a way to directly invoke the easy_install.py to install .egg package?

enter image description here

enter image description here


Solution

  • The solution is to invoke easy_install from within a python script (credit to GitHub user @emailweixu source).

    from setuptools import setup
    
    if __name__ == '__main__':
        setup( script_args = [ '-q', 'easy_install'
                             , '-v', 'PATH_TO_YOUR_EGG_FILE'
                             ]
             )
    

    Note that this hacky solution is not going to work in the future, when setuptools removes easy_install from its code package altogether.