如何使用PyCharm社区配置可移植Python

jgwigjjp  于 2023-03-28  发布在  Python
关注(0)|答案(3)|浏览(189)

我刚刚开始尝试新的pycharm社区版。我在U盘上有一个开发环境,其中包括便携式python(http://portablepython.com)。我想配置编辑器来使用它。我已经在以下位置安装了便携式python:

F:/ppython27/Python-Portable.exe

当我尝试对此进行配置时,IDE似乎无法识别Python-Portable.exe,并且Python解释器窗口中的条目为:

Unknown at F:/ppython27/Python-Portable.exe

我该怎么补救呢?

6yoyoihd

6yoyoihd1#

我不知道这个问题是否已经解决了,但这是一个错误的exe。你需要找到“python.exe”可执行文件,就像你在正常安装python一样。虽然我怀疑Pycharm是否能100%兼容Portable Python。但一旦你这样做了,它应该基本上能工作。

bmp9r5qi

bmp9r5qi2#

通过Perica Zivkovic检查“portable python”,它似乎已经打包了pycharm。
看看它的补丁和配置文件----

  • modules.bat
:: Patch PyCharm
call COMMON :LogMessage "Patch PyCharm"
del %UNPACK_FOLDER%\PyCharm\App\PyCharm\bin\idea.properties /Q
tools\uniextract16\UniExtract.exe "patches\PyCharm.3.1.x.PPpatch" "%UNPACK_FOLDER%\PyCharm\App\PyCharm" >NUL

:: Replace @PY_VERSION@ in jdk.table.xml.tmp to %PY_VERSION% jdk.table.xml
setlocal ENABLEDELAYEDEXPANSION
set filein="%UNPACK_FOLDER%\PyCharm\App\PyCharm\.PyCharm30\config\options\jdk.table.xml.tmp"
set fileout="%UNPACK_FOLDER%\PyCharm\App\PyCharm\.PyCharm30\config\options\jdk.table.xml"
set old=@PY_VERSION@
set new=%PY_VERSION%
for /f "tokens=* delims=? %%i in ( '"type %filein%"') do (
    set str=%%i
    set str=!str:%old%=%new%!
    echo !str! >> %fileout% 
)
del %filein%
  • xml(压缩到 * PyCharm. 3. 1. x. PPpatch * 中)
<?xml version="1.0" encoding="UTF-8"?>
<application>
  <component name="ProjectJdkTable">
    <jdk version="2">
      <name value="Portable Python 2.7" />
      <type value="Python SDK" />
      <version value="Python 2.7" />
      <homePath value="$APPLICATION_HOME_DIR$/../pythonw.exe" />
      <roots>
        <classPath>
          <root type="composite">
            <root type="simple" url="file://$APPLICATION_HOME_DIR$/.." />
            <root type="simple" url="file://$APPLICATION_HOME_DIR$/../DLLs" />
            <root type="simple" url="file://$APPLICATION_HOME_DIR$/../Lib" />
            <root type="simple" url="file://$APPLICATION_HOME_DIR$/../Lib/lib-tk" />
            <root type="simple" url="file://$APPLICATION_HOME_DIR$/../Lib/site-packages" />
            <root type="simple" url="file://$APPLICATION_HOME_DIR$/../Lib/site-packages/PIL" />
            <root type="simple" url="file://$APPLICATION_HOME_DIR$/../Lib/site-packages/gtk-2.0" />
            <root type="simple" url="file://$APPLICATION_HOME_DIR$/../Lib/site-packages/win32" />
            <root type="simple" url="file://$APPLICATION_HOME_DIR$/../Lib/site-packages/win32/lib" />
            <root type="simple" url="file://$APPLICATION_HOME_DIR$/../Lib/site-packages/pythonwin" />
            <root type="simple" url="file://$APPLICATION_HOME_DIR$/../Lib/site-packages/wx-2.9.4-msw" />
            <root type="simple" url="file://$APPLICATION_HOME_DIR$/helpers/pycharm" />
            <root type="simple" url="file://$APPLICATION_HOME_DIR$/helpers/python-skeletons" />
            <root type="simple" url="file://$APPLICATION_HOME_DIR$/.PyCharm30/system/python_stubs/580531057" />
          </root>
        </classPath>
        <sourcePath>
          <root type="composite" />
        </sourcePath>
      </roots>
      <additional>
        <PATHS_ADDED_BY_USER_ROOT PATH_ADDED_BY_USER="file://$APPLICATION_HOME_DIR$/helpers/pycharm" />
      </additional>
    </jdk>
  </component>
</application>
7kjnsjlb

7kjnsjlb3#

我将PyCharm Portable与WinPython结合使用,它工作得很好。
https://portableapps.com/node/56602
https://winpython.github.io/

相关问题