0

I'm trying to create a virtual environment using a custom python build e.g. mayapy.exe -m venv myVenv but I keep getting the following error:

Error: [WinError 2] The system cannot find the file specified

This is a known issue -> https://bugs.python.org/issue43749 and has something to do with the fact that I'm working with a renamed executable.

Do you guys have any work around for this issue?

  • Is this part of some automated process? I would just make a script to rename the `myapy.exe` into `python.exe`, to create the venv and then to rename the `python.exe` back to `myapy.exe`. Other possibility would be to hunt down the bug and help `venv` developers to fix it. – Niko Föhr Dec 24 '21 at 19:40
  • @np8 sadly renaming the executable won't work. What do you mean by "is this part of some automated process?" – Roure Ossó Dec 24 '21 at 20:26
  • Oh, I was thinking that if the executable could be renamed temporarily. And that would be only useful, if you need to create virtual environments inside a script or otherwise non-manually. – Niko Föhr Dec 25 '21 at 09:37

1 Answers1

1

Since you're in a windows environment, you can try creating a symbolic link at the same location. A symbolic link is like a file system shortcut. Open the Command Shell with Administrator Privileges. Navigate to the location of mayapy.exe from within the shell and type:

mklink python.exe mayapy.exe

It creates a symbolic link in the file system. If it doesn't work try the /H option.

Klaudikus
  • 382
  • 3
  • 12
  • For the record, Maya has additional/unique dependencies in their version of Python (mayapy.exe), so creating a virtual environment might be more involved than simply creating symbolic link. – Klaudikus Feb 25 '22 at 13:05