I can't find anything in the conda specs which allow you to export an environment file without the prefix: ... line. However, as Alex pointed out in the comments, conda doesn't seem to care about the prefix line when creating an environment from file.
With that in mind, if you want the other user to have no knowledge of your default install path, you can remove the prefix line with grep before writing to environment.yml.
conda env export | grep -v "^prefix: " > environment.yml
Either way, the other user then runs:
conda env create -f environment.yml
and the environment will get installed in their default conda environment path.
If you want to specify a different install path than the default for your system (not related to 'prefix' in the environment.yml), just use the -p flag followed by the required path.
conda env create -f environment.yml -p /home/user/anaconda3/envs/env_name
Note that Conda recommends creating the environment.yml by hand, which is especially important if you are wanting to share your environment across platforms (Windows/Linux/Mac). In this case, you can just leave out the prefix line.
conda env create -f environment.ymlJust as an aside, in my experience this is not going to work across platforms, because conda env will list many dependencies such as ` vs2015_runtime` if you are on Windows. But of course that is not available on linux. - Alex G Riceenvironment.ymlfile by hand, so you could leave it out - see stackoverflow.com/questions/39280638/… - Brian Burns