Hi,
I think the problem is that you use sudo. When you do this, it switch the environment to the root one, and so the env variable you define inline are not used.
In general, you don’t want to use sudo when you install pytorch. If you use linux, you can setup your rights to be in the staff group to be able to do global install without sudo. Or you can do a per-user install by adding a --user to the install command.