virtualenv in PowerShell?

后端 未结 13 2081
悲&欢浪女
悲&欢浪女 2020-12-12 20:32

Hi fellow pythonistas, there seems to be a problem when virtualenv is used in PowerShell.

When I try to activate my environment in PowerShell like..

> env

13条回答
  •  不思量自难忘°
    2020-12-12 21:31

    Inside of the Scripts directory of your virtual environments folder there are several activation scripts that can be used depending on where you are executing the command. If you are trying to activate your virtual env from the Windows PowerShell, try using the following command:

    . .\env\Scripts\activate.ps1

    In the event you receive an error about the activation script being disabled on your system, you will first need to invoke an execution policy change on your system. This will need to be done as the administrator.

    To do this:

    1) Right click on the PowerShell application and select Run as Administrator

    2) Run the following command: Set-ExecutionPolicy Unrestricted

    3) Rerun the activation command: . .\env\Scripts\activate.ps1

提交回复
热议问题