Search code examples
pythonpipvirtualenvpyinstallervirtual-environment

why pyinstaller available in virtual environment even I did not install it


I created a python virtual environment by virtualenv and activate it, then I found I can use pyinstaller in this vir-env, but I had not "pip install pyinstaller" in it, why? And as comparison, I wrote 'import <not_installed_module>' in code, then it threw up 'module unfound' and it is as expected.

---- updated 1st ---- thanks to reminder, added my operation enter image description here

---- updated 2nd ----- thanks to comments, it shows the pyinstaller is still in system path enter image description here


Solution

  • thanks to all comments, they help me get the answer:

    when I enter vir-env, and not install pyinstaller, I run where pyinstaller (win-10) and get the system-wide installed one:

    C:\Users\ME\AppData\Local\Programs\Python\Python310\Scripts\pyinstaller.exe

    then I install pyinstaller in vir-env by pip install pyinstaller, and run where pyinstaller, I get two:

    (prj_path)\.venv\Scripts\pyinstaller.exe C:\Users\ME\AppData\Local\Programs\Python\Python310\Scripts\pyinstaller.exe

    now I run "pyinstaller ..." It calls the pyinsaller in vir-env