When working with environment.yml files, it is easiest to navigate in the Anaconda Prompt or Terminal to the folder holding the enviornment file. To do this, you'll need to know the full path name of the folder.
A good guide for finding the full path of the folder is available here.
I usually use "Method 2," which involves navigating to the folder in the File Explorer, right clicking, selecting the "Properties" option, and copying the file path.
On Mac, here is a guide to copy a folder's path name. It involves navigating to the folder in Finder, right clicking, holding down the "Option" key, and selecting the "Copy as Pathname".