Pycharm的Interpreter无法识别已经安装的WSL-Ubuntu-22.04

在使用PyCharm2020.1时,尽管已在WSL2中成功安装了Ubuntu-22.04并运行Python程序,但PyCharm提示没有安装WSL分布。问题源于PyCharm版本过低,无法自动识别新版本的Ubuntu。解决方案是手动编辑pycharm的wsl.distributions.xml文件,添加Ubuntu-22.04的配置信息后重启PyCharm。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

背景

使用WSL2,已经安装Ubuntu-22.04,python程序已经在WSL中运行成功,希望在Pycharm-2020.1中编码,此时试图添加Interpreter。

问题

Pycharm:You don't have WSL distribution installed. Install WSL distributions.

在已有WSL的情况下,Pycharm无法识别到

解决过程及结论

  • 结论申明:Pycharm版本过低,无法识别到Ubuntu22.04
  • 解决方案:
    • 找到pycharm的wsl.distributions.xml
      在这里插入图片描述
    • 打开并在内部添加如下代码
        <descriptor>
          <id>UBUNTU2204</id>
          <microsoft-id>Ubuntu-22.04</microsoft-id>
          <executable-path>ubuntu2204.exe</executable-path>
          <presentable-name>Ubuntu 22.04</presentable-name>
        </descriptor>
    
    在这里插入图片描述
    • 重启Pycharm
      在这里插入图片描述
  • 参考链接:
    • https://youtrack.jetbrains.com/issue/PY-32424
    • https://www.jetbrains.com/help/ruby/how-to-use-wsl-development-environment-in-product.html#custom_wsl
Installation The code has been tested with Docker (see Docker container below) with Python 3.8, CUDA 10.2/11.1, pytorch 1.8.0 and pytorch-lighting 1.4.1. Any other version may require to update the code for compatibility. Pip/Venv/Conda In your virtual environment follow MinkowskiEnginge. This will install all the base packages. Additionally, you need to install: open3d 0.13.0 pytorch-lighting 1.4.1 wandb tqdm pickle 这是readme里的内容,hi有,没有requirments。,再给一遍https://github.com/saltoricristiano/cosmix-uda/tree/main/configs/adaptation/uda 我现在要通过wslpycharm上运行这个项目,给我步骤 这个项目用Ubuntu24.04可行吗 还有,你上面给我的步骤我运行以后还是一样的报错(cosmix) livvy0102@tong:~/anaconda3/bin$ sudo apt update Get:1 file:/var/cuda-repo-ubuntu2004-11-1-local InRelease Ign:1 file:/var/cuda-repo-ubuntu2004-11-1-local InRelease Get:2 file:/var/cuda-repo-ubuntu2404-12-6-local InRelease [1572 B] Get:2 file:/var/cuda-repo-ubuntu2404-12-6-local InRelease [1572 B] Get:3 file:/var/cuda-repo-ubuntu2004-11-1-local Release [564 B] Get:3 file:/var/cuda-repo-ubuntu2004-11-1-local Release [564 B] Get:4 file:/var/cuda-repo-ubuntu2004-11-1-local Release.gpg [836 B] Get:4 file:/var/cuda-repo-ubuntu2004-11-1-local Release.gpg [836 B] Ign:4 file:/var/cuda-repo-ubuntu2004-11-1-local Release.gpg Hit:5 http://security.ubuntu.com/ubuntu noble-security InRelease Hit:6 http://archive.ubuntu.com/ubuntu noble InRelease Hit:7 http://archive.ubuntu.com/ubuntu noble-updates InRelease 0% [Waiting for headers] Hit:8 http://archive.ubuntu.com/ubuntu noble-backports InRelease Reading package lists... Done W: GPG error: file:/var/cuda-repo-ubuntu2004-11-1-local Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F60F4B3D7FA2AF80 E: The repository 'file:/var/cuda-repo-ubuntu2004-11-1-local Release' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. (cosmix) livvy0102@tong:~/anaconda3/bin$
03-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值