为什么我的pycharm终端无法启动

问题描述 投票:0回答:1

我最近在 PyCharm 中的终端遇到问题,它总是给我这个错误消息:

Cannot open Local
Failed to start [powershell.exe, -NoExit, -ExecutionPolicy, Bypass, -File, C:\Program Files\JetBrains\PyCharm Community Edition 2023.1.4\plugins\terminal\shell-integrations\powershell\powershell-integration.ps1] in C:\Users\asus\PycharmProjects\pythonProject, [columns=161, rows=12], envs={CommonProgramFiles=>C:\Program Files\Common Files, =::=>::\, FPS_BROWSER_USER_PROFILE_STRING=>Default, USERDOMAIN=>DESKTOP-UI792GH, ProgramData=>C:\ProgramData, COMPUTERNAME=>DESKTOP-UI792GH, OneDriveCommercial=>C:\Users\asus\OneDrive - International Information Technology University, SystemDrive=>C:, IJ_RESTARTER_LOG=>C:\Users\asus\AppData\Local\JetBrains\PyCharmCE2024.2\log\restarter.log, OneDriveConsumer=>C:\Users\asus\OneDrive, OneDrive=>C:\Users\asus\OneDrive - International Information Technology University, CommonProgramFiles(x86)=>C:\Program Files (x86)\Common Files, TMP=>C:\Users\asus\AppData\Local\Temp, TEMP=>C:\Users\asus\AppData\Local\Temp, VBOX_MSI_INSTALL_PATH=>C:\Program Files\Oracle\VirtualBox\, ProgramFiles=>C:\Program Files, windir=>C:\WINDOWS, USERDOMAIN_ROAMINGPROFILE=>DESKTOP-UI792GH, PyCharm Community Edition=>C:\Program Files\JetBrains\PyCharm Community Edition 2023.1.4\bin;, PROCESSOR_LEVEL=>6, ComSpec=>C:\WINDOWS\system32\cmd.exe, NUMBER_OF_PROCESSORS=>12, PROCESSOR_ARCHITECTURE=>AMD64, OS=>Windows_NT, EFC_11668=>1, JETBRAINS_INTELLIJ_COMMAND_END_MARKER=>mcNkZuvsa73YFEdO8heyjV04N8vnV5MkXIVYFDfZYaKCASgpAAYtst2VMfOFRpn8, EnableLog=>INFO, ProgramFiles(x86)=>C:\Program Files (x86), PSModulePath=>C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules, PATHEXT=>.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC, PROCESSOR_IDENTIFIER=>Intel64 Family 6 Model 141 Stepping 1, GenuineIntel, APPDATA=>C:\Users\asus\AppData\Roaming, ACSetupSvcPort=>23210, RlsSvcPort=>22112, LOCALAPPDATA=>C:\Users\asus\AppData\Local, SystemRoot=>C:\WINDOWS, HOMEPATH=>\Users\asus, JEDITERM_SOURCE=>C:/Users/asus/PycharmProjects/pythonProject/venv/Scripts/activate.ps1, TERMINAL_EMULATOR=>JetBrains-JediTerm, LOGONSERVER=>\\DESKTOP-UI792GH, SESSIONNAME=>Console, IGCCSVC_DB=>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAqbskprLcEUirO6fdagZJVgQAAAACAAAAAAAQZgAAAAEAACAAAACcqrx2cOfxrLXDAgEcxO9UcKqoHrkxx+Pkc0scGzo32AAAAAAOgAAAAAIAACAAAAB8XTU4p3yRXeLABSjbooS/tpcZvq1AcqI5kki53CWv12AAAABF3DKEpR9wBeYn0uJYh4Uu8LntGr2o3Ao4DJa7K0aOrXHgTLzVRmecZc3e9A0Rq6sduRUJoNTbJvZqgBcrtRpK5DoF766+J89YYw9ToDdBp/fEQX118WYk8febvSX1k2dAAAAAwvKlUmib2UFScHW6GnFFjfkRg0wPU7zCyj5mpqJKsIOnDrw9ZOqiiy+Uy7GvY94JHKpPuCR2w/qzyniCJCBqhg==, HOMEDRIVE=>C:, DriverData=>C:\Windows\System32\Drivers\DriverData, FPS_BROWSER_APP_PROFILE_STRING=>Internet Explorer, Path=>C:\Users\asus\Desktop\aircrack-ng-1.7-win\aircrack-ng-1.7-win\bin;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\nodejs\;C:\Program Files\dotnet\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;"C:\Users\asus\AppData\Local\Programs\Python\Python312\python.exe";C:\Program Files\JetBrains\PyCharm Community Edition 2023.1.4\bin;, PUBLIC=>C:\Users\Public, PT8HOME=>C:\Program Files\Cisco Packet Tracer 8.2.2, ACSvcPort=>17532, IDEA_INITIAL_DIRECTORY=>C:\Users\asus, PROCESSOR_REVISION=>8d01, USERPROFILE=>C:\Users\asus, ALLUSERSPROFILE=>C:\ProgramData, USERNAME=>asus, CommonProgramW6432=>C:\Program Files\Common Files, ProgramW6432=>C:\Program Files, ZES_ENABLE_SYSMAN=>1, TERM_SESSION_ID=>ed4df495-a2ac-4e5c-bd92-fc2c33b3b393}


See IDE log (Help | Show Log in Explorer) for the details. 

enter image description here

我尝试重新安装PyCharm和Python,但没有解决问题。我还尝试修改 Windows 环境中的 PATH,但这也没有帮助。(https://i.sstatic.net/nSVm6vPN.png)

尝试修改翻译但没有得到任何结果。我对编码还是新手,但终端之前已经工作了一段时间,我想不出任何可能导致这个问题的事情

编辑:

抱歉问了一个混乱的问题,我睡眠不足,而且坦白说英语不太好(这是我的第三语言)。

我能够手动启动终端(使用调试按钮),但问题仍然存在。我按照 Charles Knell 的建议更新了 PyCharm,甚至重新安装了 PowerShell,但问题仍然存在。当在 PyCharm 更新版本中使用新终端(测试版)时,错误消息消失了,但也可以输入了

如果您感兴趣,我使用此代码手动激活它:

$script:THIS_PATH = $myinvocation.mycommand.path
$script:BASE_DIR = Split-Path (Resolve-Path "$THIS_PATH/..") -Parent

function global:deactivate([switch] $NonDestructive) {
    if (Test-Path variable:_OLD_VIRTUAL_PATH) {
        $env:PATH = $variable:_OLD_VIRTUAL_PATH
        Remove-Variable "_OLD_VIRTUAL_PATH" -Scope global
    }

    if (Test-Path function:_old_virtual_prompt) {
        $function:prompt = $function:_old_virtual_prompt
        Remove-Item function:\_old_virtual_prompt
    }

    if ($env:VIRTUAL_ENV) {
        Remove-Item env:VIRTUAL_ENV -ErrorAction SilentlyContinue
    }

    if (!$NonDestructive) {
        # Self destruct!
        Remove-Item function:deactivate
        Remove-Item function:pydoc
    }
}

function global:pydoc {
    python -m pydoc $args
}

# unset irrelevant variables
deactivate -nondestructive

$VIRTUAL_ENV = $BASE_DIR
$env:VIRTUAL_ENV = $VIRTUAL_ENV

New-Variable -Scope global -Name _OLD_VIRTUAL_PATH -Value $env:PATH

$env:PATH = "$env:VIRTUAL_ENV/Scripts;" + $env:PATH
if (!$env:VIRTUAL_ENV_DISABLE_PROMPT) {
    function global:_old_virtual_prompt {
        ""
    }
    $function:_old_virtual_prompt = $function:prompt

    if ("" -ne "") {
        function global:prompt {
            # Add the custom prefix to the existing prompt
            $previous_prompt_value = & $function:_old_virtual_prompt
            ("() " + $previous_prompt_value)
        }
    }
    else {
        function global:prompt {
            # Add a prefix to the current prompt, but don't discard it.
            $previous_prompt_value = & $function:_old_virtual_prompt
            $new_prompt_value = "($( Split-Path $env:VIRTUAL_ENV -Leaf )) "
            ($new_prompt_value + $previous_prompt_value)
        }
    }
}
python compiler-errors pycharm interpreter
1个回答
0
投票

确保您使用的是正确版本的pycharm社区。有一种适用于 ARM64,另一种适用于 x64。

要检查您的PC是否运行ARM64架构,您可以按照以下步骤操作:

instructions to determine ARM64 or x64

Python社区最新版本的下载链接位于以下页面底部:pycharm下载

© www.soinside.com 2019 - 2024. All rights reserved.