I’m working on a project in PyCharm that includes several Git submodules. Each submodule has its own requirements, so I need to use a different Python interpreter
Is there a way to set up PyCharm so that it automatically uses the correct interpreter depending on the submodule I’m working in?
In VS Code, you can handle this by adding each submodule as a separate workspace and assigning a specific interpreter to each. Does PyCharm have anything similar?
I’m working on a project in PyCharm that includes several Git submodules. Each submodule has its own requirements, so I need to use a different Python interpreter
Is there a way to set up PyCharm so that it automatically uses the correct interpreter depending on the submodule I’m working in?
In VS Code, you can handle this by adding each submodule as a separate workspace and assigning a specific interpreter to each. Does PyCharm have anything similar?
Share Improve this question asked Nov 19, 2024 at 13:33 Pryduvys OleksandrPryduvys Oleksandr 794 bronze badges 3- 1 In terms of the IntelliJ platform, PyCharm is a single-module IDE, so you only have one module per project and thus only one SDK/interpreter. Most JetBrains IDEs work this way, except for the multi-module IntelliJ IDEA, which does support your use case. – InSync Commented Nov 19, 2024 at 13:40
- 1 why not create a runner script which sets PATH variable and then execute the python script/module? So effectively I am suggesting to run directly from command line instead of from IDE. Now, you are free to configure as per your requirement – Anubhav Sharma Commented Nov 19, 2024 at 13:45
- @AnubhavSharma Good idea, but I need dynamic interpreter switching in PyCharm for code analysis and autocomplete. Your solution skips that, which defeats the point of using an IDE. – Pryduvys Oleksandr Commented Nov 19, 2024 at 14:14
1 Answer
Reset to default 1In the Run debug configurations (top corner right) you can specify the "python interpreter" for each run/debug setting as well as env variables, flags, paths, entry points and many other things.
You can use a tool such as poetry to create and manage the different environments, but even that can be managed from the IDE.