VS Code 无法找到 python libpython3.10.so。

huangapple go评论67阅读模式
英文:

VS Code cannot find python libpython3.10.so

问题

I am trying to select a vritual environment as the default interpreter for python in vs code, but this fails. In the terminal I can, without issues run

在尝试将虚拟环境选择为 VS Code 中的 Python 默认解释器时出现问题。在终端中,我可以轻松运行以下命令:

$ <venv_path>/python
Python 3.10.8 (main, Mar 14 2023, 20:30:44) [GCC 12.2.0] on linux
Type "help", "copyright", "credits", or "license" for more information.

或者

which python
<venv_path>/python

after the environment has been activated. Furthermore, in the terminal, I can see that

此外,在终端中,我可以看到

echo $LD_LIBRARY_PATH
...:/opt/<...>/lib/:...

which means that the libraries can be found from the terminal so the python can run. Now the problem. When I try to select <venv_path>/python as the interpreter for the opened project, this fails with an error message. In the output window I see the following:

这意味着库可以从终端中找到,因此 Python 可以运行。现在问题出现了。当我尝试将 <venv_path>/python 选择为打开项目的解释器时,出现错误消息。在输出窗口中,我看到以下内容:

[Error: Command failed: <venv_path>/python -I /<...>/.vscode-server/extensions/ms-python.python-2023.6.0/pythonFiles/get_output_via_markers.py /<...>/.vscode-server/extensions/ms-python.python-2023.6.0/pythonFiles/interpreterInfo.py <br>
<venv_path>/python: error while loading shared libraries: libpython3.10.so.1.0: cannot open shared object file: No such file or directory

Which means that vs code was not able to find the library. Why is that and how can I fixt that?

这意味着 VS Code 无法找到库。为什么会发生这种情况,我该如何修复它?

英文:

I am trying to select a vritual environment as the default interpreter for python in vs code, but this fails. In the terminal I can, without issues run

$ &lt;venv_path&gt;/python
Python 3.10.8 (main, Mar 14 2023, 20:30:44) [GCC 12.2.0] on linux
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.

or

which python
&lt;venv_path&gt;/python

after the environment has been activated. Furthermore, in the terminal, I can see that

echo $LD_LIBRARY_PATH
...:/opt/&lt;...&gt;/lib/:...

which means that the libraries can be found from the terminal so the python can run. Now the problem. When I try to select &lt;venv_path&gt;/python as the interpreter for the opened project, this fails with an error message. In the output window I see the following:

> [Error: Command failed: <venv_path>/python -I /<...>/.vscode-server/extensions/ms-python.python-2023.6.0/pythonFiles/get_output_via_markers.py /<...>/.vscode-server/extensions/ms-python.python-2023.6.0/pythonFiles/interpreterInfo.py <br>
> <venv_path>/python: error while loading shared libraries: libpython3.10.so.1.0: cannot open shared object file: No such file or directory

Which means that vs code was not able to find the library. Why is that and how can I fixt that?

答案1

得分: 0

问题出现在一个HPC集群上,事实证明,总是有一些后台进程仍然在我的帐户上活动。快速执行 "killall -u " 杀死所有以我的名字运行的进程。重新使用SSH登录后,问题得以解决。

英文:

As it turned out (this problem occured on an HPC cluster) there was always some backgroud process still active for my account. A quick killall -u <username> everything running in my name. After logging back in with ssh the problem was resolved.

huangapple
  • 本文由 发表于 2023年4月7日 04:35:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/75953556.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定