Issue with virtualenv - cannot activate

前端 未结 25 1869
借酒劲吻你
借酒劲吻你 2020-12-04 05:20

I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now.

You can see

相关标签:
25条回答
  • 2020-12-04 05:46
    1. For activation you can go to the venv your virtualenv directory by cd venv.

    2. Then on Windows, type dir (on unix, type ls). You will get 5 folders include, Lib, Scripts, tcl and 60

    3. Now type .\Scripts\activate to activate your virtualenv venv.

    Your prompt will change to indicate that you are now operating within the virtual environment. It will look something like this (venv)user@host:~/venv$.

    And your venv is activated now.

    0 讨论(0)
  • 2020-12-04 05:46

    If you are using windows OS then in Gitbash terminal use the following command $source venv/Scripts/activate. This will help you to enter the virtual environment.

    0 讨论(0)
  • 2020-12-04 05:50

    For windows, type "C:\Users\Sid\venv\FirstProject\Scripts\activate" in the terminal without quotes. Simply give the location of your Scripts folder in your project. So, the command will be location_of_the_Scripts_Folder\activate.

    0 讨论(0)
  • 2020-12-04 05:51

    source is a shell command designed for users running on Linux (or any Posix, but whatever, not Windows).

    On Windows, virtualenv creates a batch file, so you should run venv\Scripts\activate instead (per the virtualenv documentation on the activate script).

    Edit: The trick here for Windows is not specifying the BAT extension:

    PS C:\DEV\aProject\env\Scripts> & .\activate
    (env) PS C:\DEV\aProject\env\Scripts>

    0 讨论(0)
  • 2020-12-04 05:51

    I was also facing the same issue in my Windows 10 machine. What steps i tried were:

    Go to andconda terminal Step 1

    pip3 install -U pip virtualenv
    

    Step 2

    virtualenv --system-site-packages -p python ./venv
    

    or

    virtualenv --system-site-packages -p python3 ./venv
    

    Step 3

    .\venv\Scripts\activate
    

    You can check it via spider tool in anaconda by typing import tensorflow as tf

    0 讨论(0)
  • 2020-12-04 05:52

    If you see the 5 folders (Include,Lib,Scripts,tcl,pip-selfcheck) after using the virtualenv yourenvname command, change directory to Scripts folder in the cmd itself and simply use "activate" command.

    0 讨论(0)
提交回复
热议问题