An error is reported when activating the virtual environment in the Windows10 environment [source: The item "source" cannot be recognized as the name of a cmdlet, function, script file, or executable program]

1. Problem description

        Before using Django to create a web program, you need to create a virtual working environment. When using the [source ll_env/bin/activate] command to activate the virtual environment, an error is reported:

[ source : The item 'source' is not recognized as the name of a cmdlet, function, script file, or executable program.
Please check the spelling of the name, and if a path is included, make sure it is correct and try again.
Location line: 1 Character: 2
】As shown in the figure below:

2. Problem analysis

        [source ll_env/bin/activate] activation or virtual machine commands are used in the Linux environment; while the Windows environment uses the [ll_env\Scripts\activate] command to activate the virtual machine.

3. Solutions

3.1. Install the virtual environment

Install the virtual environment command:

pip install virtualenv

3.2. Create a virtual environment

Create a virtual environment command:

python -m venv ll_env

3.3. Activate the virtual environment

Windows activate virtual environment command:

ll_env\Scripts\activate

 

Guess you like

Origin blog.csdn.net/xiaochenXIHUA/article/details/130153956