There are Environment Markers or Requirement Specifiers we can use in requirements.txt
. For example, argparse;python_version<"2.7"
will tell pip to install argparse
only when the python version is less than 2.7.
However, is it possible to generate these environment markers when using pip freeze > requirements.txt
? Documentation of pip freeze does not mention a way. I tried the -r
option but had no luck. Do we have to edit the requirements.txt
file manually after pip freeze
?