Search code examples
python-3.xpycharmportable-applications

Where does PyCharm store the Python Interpreters?


I would like to put PyCharm and WinPython under version control and store the relative path to the python interpreter in the PyCharm settings.

=>What PyCharm configuration file do I need to adapt to store the path to my Python Interpreter?

Is it included in one of following directories?

-Didea.properties.file="%PAL:AppDir%\PyCharm\bin\idea.properties" 
-Didea.config.path="%PAL:DataDir%\config" 
-Didea.system.path="%PAL:DataDir%\system" 
-Didea.plugins.path="%PAL:DataDir%\config\plugins" 
-Didea.log.path="%PAL:DataDir%\system\log"

enter image description here

My current configuration for a portable app (based on https://portableapps.com/node/56602):

PyCharmPortable.ini

[Launch]
ProgramExecutable=\PyCharm\jbr\bin\javaw.exe
CommandLineArguments=-Djb.vmOptionsFile="%PAL:AppDir%\PyCharm\bin\pycharm64.exe.vmoptions" -XX:ErrorFile="%PAL:DataDir%\java_error_in_pycharm.log" -XX:HeapDumpPath="%PAL:DataDir%\java_error_in_pycharm.hprof" -Didea.properties.file="%PAL:AppDir%\PyCharm\bin\idea.properties" -Didea.config.path="%PAL:DataDir%\config" -Didea.system.path="%PAL:DataDir%\system" -Didea.plugins.path="%PAL:DataDir%\config\plugins" -Didea.log.path="%PAL:DataDir%\system\log" -Didea.platform.prefix=PyCharmCore -cp "%PAL:AppDir%\PyCharm\lib\bootstrap.jar;%PAL:AppDir%\PyCharm\lib\util.jar;%PAL:AppDir%\PyCharm\lib\jdom.jar;%PAL:AppDir%\PyCharm\lib\log4j.jar;%PAL:AppDir%\PyCharm\lib\jna.jar" com.intellij.idea.Main
WorkingDirectory=%PAL:AppDir%\PyCharm
DirectoryMoveOK=yes
SupportsUNC=yes

[Activate]
Registry=false
XML=true

[Environment]
JAVA_HOME=%PAL:AppDir%\PyCharm\jbr
PYTHON=%PAL:AppDir%\WinPython\python-3.9.4.amd64\python.exe
PYTHON_PATH=%PAL:AppDir%\WinPython\python-3.9.4.amd64;%PAL:AppDir%\WinPython\python-3.9.4.amd64\Scripts;%PAL:AppDir%\WinPython\python-3.9.4\Lib
VEUSZ=%PAL:AppDir%\Veusz
CPLEX=%PAL:AppDir%\cplex\bin\x64_win64
WINGLPK=%PAL:AppDir%\WinGlpk\w64
GUROBI=%PAL:AppDir%\gurobi\win64
PATH=%PYTHON_PATH%;%VEUSZ%;%CPLEX%;%WINGLPK%;%GUROBI%;%PATH%

Solution

  • It is under

    idea.config.path => options => file "jdk.table.xml" => "homePath"

    <application>
      <component name="ProjectJdkTable">
        <jdk version="2">
          <name value="Python 3.9" />
          <type value="Python SDK" />
          <version value="Python 3.9.4" />
          <homePath value="C:\python_env\App\WinPython\python-3.9.4.amd64\python.exe" />
    ...
    

    Furthermore, PyCharm supports the variable $APPLICATION_HOME_DIR$:

     <homePath value="$APPLICATION_HOME_DIR$\..\WinPython\python-3.9.4.amd64\python.exe" />
    

    idea.config.path sample at ~/.config/JetBrains/IntelliJIdea2022.2