Skip to content

python ModuleNotFoundError in ubuntu #199835

@Xinchengzelin

Description

@Xinchengzelin

Does this issue occur when all extensions are disabled?: No

  • VS Code Version: 1.81.1
  • OS Version: ubuntu20.04

Steps to Reproduce:

  1. I have a little project, the structure is as follows, I want to import module2.py in module1.py
    -project
    ----module1
    ---------module1.py
    ----module2
    ---------module2.py
# module1.py
from module2.module2 import xxx
# error:
# ModuleNotFoundError: No module named 'module2'

  1. I add configuration in launch.json, however, it works in windows but not works in ubuntu20.04
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true,
            "env": {"PYTHONPATH": "${workspaceFolder}${pathSeparator}${env:PYTHONPATH}"}
        }
    ]
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions