错误:无法执行“--user”安装。用户站点包在此 virtualenv 中不可见

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

实际上,我想创建我的第一个 django 项目。在 cmd 中进行一些编码后,我使用 Visual Studio Code 打开代码。我在状态栏上选择了python解释器,然后将其更改为我的数字环境中安装的python解释器。之后,我收到消息说 linter pylint 未安装。我安装后,出现这些错误。

enter image description here

python django virtualenv
3个回答
16
投票

这个解决方案对我有用。在这里重复一遍:

1. Go to the `pyvenv.cfg` file in the Virtual environment folder
2. Set the `include-system-site-packages` to `true` and save the change
3. Reactivate the virtual environment.

0
投票

当我想安装 python 模块时,我确实遇到了同样的错误。这是因为你想在项目中安装用户特定的模块,而虚拟环境用户站点包不可见。--user 安装 python 包对于当前用户而不是系统的用户。你可以使用这个

pip install <python package>

而不是

pip install --user <python package>


-3
投票

如本期所述,您必须将“全局模块安装”设置为true。

您可以通过“文件”>“首选项”>“设置”来执行此操作:

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