1

After I create a symbolic link for python.exe, I can start up python when I double click the symbolic link. But when I enter the symbolic link into the command prompt, it tells me that can not find python.dll. So I have two questions as follows:

  1. Is double click different from command prompt, why the former works fine but the later not?
  2. How can I start up python by entering the symbolic link into the command prompt, without encountering can not find python.dll?

Some details that may help solve the problem:

  • The operation system is Windows 11.
  • The symbolic link is located in E:\sybmolic\py.exe while python is located in E:\python\python.exe.
Qiu Junyan
  • 31
  • 2
  • python.exe looks for python.dll in the same folder, so if python.exe was started from another folder and python.dll wasn't in search path so obviously it can't run – phuclv Apr 07 '22 at 07:52
  • @phuclv This is the point I have thought about. I have tried other two ways but all failed. First, I created a symbolic link for `python.dll` too and ran again, the command prompt told me that `can not start up the application`. Second, I directly created a symbolic link for the whole python direcotry, but this symbolic link can Not be visited in command prompt even if I have added environment variables. Anyway, thanks for that you tried to help me :) – Qiu Junyan Apr 07 '22 at 08:16
  • for a folder you need junction points instead of symlinks. But why do you want to do that? Why don't just use a normal shortcut? – phuclv Apr 07 '22 at 08:42
  • @phuclv The reason why I do this thing is that I want to call different python versions (e.g. `python2.x` and `python3.x`) in cmd without using absolute path. So if I can create diffrent symlinks for different python versions, then I can just choose symlink to choose python version. Thanks for your attention, I will try other methods proposed in [this page](https://stackoverflow.com/questions/4583367/how-to-run-multiple-python-versions-on-windows). – Qiu Junyan Apr 07 '22 at 11:14
  • [This is an XY problem](https://meta.stackexchange.com/q/66377/230282). If you asked how to run multiple python versions then it'll be clear right from the beginning. There's no need to use symlink for that, a shortcut or an alias would help. Or just change `%PATH%` – phuclv Apr 07 '22 at 12:17

0 Answers0