Getting PyCharm to recognize python on the windows linux subsystem (bash on windows)

前端 未结 7 1718
不思量自难忘°
不思量自难忘° 2020-12-12 15:07

While running Linux versions of python, pip etc. \"natively\" on windows is amazing, I\'d like to do so using a proper IDE. Since SSHD compatibility has not been implemented

7条回答
  •  粉色の甜心
    2020-12-12 15:39

    Configure remote interpreter via WSL #

    1. Open the Add Python Interpreter dialog by either way:

      • When you're in the Editor, the most convenient way is to use the Python Interpreter widget in the Status bar. Click the widget and select Add Interpreter ...

      • If you are in the Settings/Preferences dialog (Ctrl+Alt+S), select Project | Project Interpreter. Click The Configure project interpreter icon and select Add.

    2. In the left-hand pane of the dialog, click WSL.

    Use Anaconda:

    .\rootfs\home\$UserName$\anaconda\envs\$Conda_Env$\bin\python3

    Use Pyhton: Adding a WSL interpreter

    1. Select the Linux distribution and specify the path to the python executable in the selected Linux distribution.

    Once done, the new interpreter will be added to your project, and the default mnt mappings will be set.

    Newly added WSL interpreter

    Note that with WSL you cannot create virtual environments: all packages you install will be added to the corresponding system interpreter. You will be asked to enter your sudo password.

    Entering your sudo password

    Reference: JetBrains

提交回复
热议问题