如何在没有管理员权限的情况下激活Python虚拟环境?

3

Python 3.8.3,Windows 10

我使用Python的virtualenv软件包创建了一个虚拟环境,使用以下命令:

python -m venv C:/<Path>

现在当我尝试使用以下命令激活虚拟环境时:

.\C:/<Path>/activate.bat

I get the following error message:

This program is blocked by group policy. For more information, contact your system administrator.

很遗憾,我无法绕过这台计算机上的管理员阻止,请问我能做些什么呢?
1个回答

1
尝试将符号/替换为\
.\C:<Path>\activate.bat

In windows env activated like this

%venv_folder%\Scripts\activate.bat

或者您可以使用pipenv。
1.
pip install pipenv

2.
pipenv shell

3.

pipenv install <lib_name>
  1. 使用以下命令激活环境
exit

使用pipenv。如果没有虚拟环境,pipenv shell会创建一个,并一次性激活它,而不需要请求管理员权限。 - Charly Phillips

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接