How to freeze requirements.txt in python?

I am trying to freeze a requirement document for implement a machine learning model.
I am using pip 20.2.3. While run the “pip freeze> requirements.txt” in anaconda command prompt it shows me “pip is not recognized as internal or external command, operable program or batch file”.
I tried install other libraries, pip is working fine. But while running ‘pip freeze> requirements.txt’ it is not working for me.

I am not able to fix this issue.

Any help on this issue is greatly appreciable.
Thanks a lot.

Does it work if you do not include the file at the end and just let it print to the console?

If so, you’ll need to report it to the Anaconda team through one of their support channels. They don’t usually hang around here.

Conda’s environment.yml includes a pip: section listing packages to install with pip instead of conda or mamba:

conda env export -f environment.yml
conda env export --from-history -f env.yml

--from-history generates environment.yml from the log of installs instead of including all packages and their dependencies.