简体   繁体   中英

pip freeze works in cmd but not in powershell

When I use the pip freeze command in cmd, I get a list of packages as expected, but if I run the same command in Powershell, nothing is returned:

pip freeze in cmd vs powershell

Why don't I get the same result in Powershell as I get in cmd?

Ok, I found out what the problem was. It turns out pip was calling pip from Python 3.9 in cmd, and from 3.8 in Powershell for some reason. Since the packages were installed by the 3.9 pip, they weren't shown in Powershell. It works like it's supposed to when I force the right version by calling py.

PS C:\Python39\Scripts> py -3.9 -m pip -V pip 20.2.3 from C:\Python39\lib\site-packages\pip (python 3.9)

PS C:\Python39\Scripts> py -3.8 -m pip -V pip 20.2.4 from C:\Python38\lib\site-packages\pip (python 3.8)

PS C:\Python39\Scripts> py -3.9 -m pip freeze

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM