Software⏱️ 3 min read📅 2026-06-11

How to Fix: Error "You must 'source' the script:" while trying to ativate python virtualenv on Windows10

Error fixing Python virtualenv on Windows 10.

Quick Answer: Try using the `--shell` option with `virtualenv` to specify a shell, such as PowerShell or Bash.

The error 'You must 'source' the script:' occurs when trying to activate a Python virtual environment on Windows 10 using PowerShell. This issue affects users who have installed Python 3.7.1 and are experiencing problems with activating their virtual environments.

This error can be frustrating, especially for developers who rely heavily on virtual environments for their projects. However, by following the steps outlined in this guide, you should be able to resolve the issue and get your environment up and running smoothly.

💡 Why You Are Getting This Error

  • The primary cause of this error is that PowerShell is not configured to source scripts by default. When you run the `activate.ps1` script, it attempts to source itself, but since PowerShell is not set to source scripts, it throws an error.
  • An alternative reason for this issue could be related to the way Python and PowerShell interact with each other. In some cases, the `activate.bat` script may work around this issue, but it's not a reliable solution.

🚀 How to Resolve This Issue

Configuring PowerShell to source scripts

  1. Step 1: Open PowerShell as an administrator. This will ensure that you have the necessary permissions to modify settings.
  2. Step 2: Run the command `Set-ExecutionPolicy RemoteSigned` to enable remote execution and signing of scripts. This will allow PowerShell to source scripts by default.
  3. Step 3: Verify that the change has taken effect by running the command `Get-ExecutionPolicy`. The output should indicate that the policy is set to RemoteSigned.

Using the `activate.bat` script

  1. Step 1: Run the `activate.bat` script instead of `activate.ps1`. This will activate your virtual environment without throwing an error.
  2. Step 2: Note that using the `activate.bat` script is not a recommended solution, as it can lead to inconsistencies and make it difficult to manage your environment.

🎯 Final Words

To resolve the 'You must 'source' the script:' error when activating Python virtual environments on Windows 10 using PowerShell, you have two options. You can configure PowerShell to source scripts by running the `Set-ExecutionPolicy RemoteSigned` command, or use the `activate.bat` script as a temporary workaround. By following these steps, you should be able to get your environment up and running smoothly.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions