[ feedback] deepin-ide打开提示安装python相关包点击安装结果失败
Tofloor
poster avatar
lijw
deepin
2024-08-24 14:07
Author

deepin v23版本,deepin-ide打开就提示建议安装python相关的包python-language-server,结果点了安装没成功,错误如下:

xxx@matebook:~$ pip install python-language-server
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
xxx@matebook:~$

Reply Favorite View the author
All Replies
把一切操作变成GUI
deepin
Backbone of ecological co-construction group
2024-08-25 03:10
#1

因为要创建Python的虚拟环境才能安装:

ide的终端里:

python -m venv ENV_DIR

ENV_DIR是你设置的虚拟环境目录

激活你的虚拟环境:

source ENV_DIR/bin/activate

然后你的ide终端命令行前面就会有

(你的虚拟环境)xxxxx:

然后你就会在这个独立虚拟环境里面安装各种模块库,

pip list可以列出这个环境里安装了的模块

现在你可以在里面使用pip install了

Reply View the author
lijw
deepin
2024-08-25 10:33
#2
把一切操作变成GUI

因为要创建Python的虚拟环境才能安装:

ide的终端里:

python -m venv ENV_DIR

ENV_DIR是你设置的虚拟环境目录

激活你的虚拟环境:

source ENV_DIR/bin/activate

然后你的ide终端命令行前面就会有

(你的虚拟环境)xxxxx:

然后你就会在这个独立虚拟环境里面安装各种模块库,

pip list可以列出这个环境里安装了的模块

现在你可以在里面使用pip install了

谢谢,我直接用了他的提示的方法:

create a virtual environment using python3 -m venv path/to/venv. Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed.

另外,用你的这个方法的话,每次打开新的终端都要重新执行一次source吗?

Reply View the author
把一切操作变成GUI
deepin
Backbone of ecological co-construction group
2024-08-25 11:11
#3
lijw

谢谢,我直接用了他的提示的方法:

create a virtual environment using python3 -m venv path/to/venv. Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed.

另外,用你的这个方法的话,每次打开新的终端都要重新执行一次source吗?

是的,希望官方能加上这个记忆虚拟环境的功能,好像vscode一样。

Reply View the author
观摩
deepin
2024-08-26 11:46
#4

如果能允许自由选择Python环境就好了

Reply View the author