简体   繁体   中英

connect pydev to wsl python

I use eclipse and pydev on windows. I need to develop on airflow, that works on linux and on wsl, but not on windows. I have a working wsl-based os (an ubuntu) with a working venv with airflow installed and running.

I was wondering if I can set up a python interpreter in pydev that points to the "wsl" python and obtain the various pydev integrations (from the autocomplete to the debugging)

Without having tried it myself, I believe the chances of using the Windows version of Eclipse/PyDev to develop using the Linux version of Python is unlikely.

While it seems that PyDev has remote debugging capabilities , I can't be sure if this works cross-platform. Even if it does, pay close attention to the note at the bottom of that page:

the file pydevd_file_utils.py must be edited to make the path translations from the client machine to the server machine and vice-versa. See the comments on that file for detailed instructions on setting the path translations.

That's going to involve some pretty serious Windows <-> WSL/Linux path translations. You might try to rely on the wslpath executable in WSL as a helper for that.

As for completions, that's where I really doubt that it's possible using Windows Eclipse/PyDev with Linux/WSL Python.

My suggestion would be to instead run the Linux version of Eclipse/PyDev under WSL. You'll need a system capable of running Linux GUI apps, of course. Under Windows 11, that's fairly straightforward with the WSLg feature. See my answer yesterday on Ask Ubuntu for more options.

I just did a quick test and was able to run Linux Eclipse/PyDev under Ubuntu in WSL2. I did run into some issues with some dialogs not being the right size (and not resizable), but I was still able to complete the installation. If you decide to go this route and find you need assistance, let me know and I'll attempt to go further with it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM