I tried pip freeze
. I need it to output just the modules delimited by newlines, like pip freeze
, except without the version number, because I am trying to create an auto upgrader, and want to do pip install --upgrade <module>
where "<module>" is the name of the module without the version number, because as far as I know, you aren't supposed to provide the version number if you are trying to upgrade a module. For example:
colorama
Flask
pywin32
Instead of what pip freeze
would do:
colorama==\<version>
Flask==\<version>
pywin32==\<version>
Where "<version>" is the version.
I looked through the documentation for pip commands or options of pip freeze
, but found none. I'm on Windows 10.
For Linux / macOS:
pip freeze | awk -F "==" '{ print $1 }'
The -F
is for specifying a custom field separator, and $1
prints the first field.
For Windows, where awk
may not be available:
pip freeze | py -c "for p in __import__('sys').stdin: print(p.split('=')[0])"