Issue with virtualenv - cannot activate

前端 未结 25 1871
借酒劲吻你
借酒劲吻你 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:38

    if you already cd your project type only in windows 10

    Scripts/activate
    

    That works for me:)

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

    In Windows platform,

    you should use this command with path specified where you have installed a virtual environment.

    $ .\env\Scripts\activate 
    

    By this, You should be able to activate this on windows.

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

    If some beginner, like me, has followed multiple Python tutorials now possible has multiple Python versions and/or multiple versions of pip/virtualenv/pipenv...

    In that case, answers listed, while many correct, might not help.

    The first thing I would try in your place is uninstall and reinstall Python and go from there.

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

    A small reminder, but I had my slashes the wrong way on Win10 cmd. According to python documentation the activate command is: C:\> <venv>\Scripts\activate.bat When you're browsing directories it's e.g. cd .env/Scripts

    So to create my venv I used python -m venv --copies .env and to activate .env\Scripts\activate.bat

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

    Ensure venv is there and just follow the commands below. It works in Windows 10.

    Go to the path where you want your virtual enviroments to reside:

    > cd <my_venv_path>
    

    Create the virtual environment named "env":

    > python -m venv env 
    

    Add the path to the git ignore file (optional):

    > echo env/ >> .gitignore
    

    Activate the virtual env:

    > .\env\Scripts\activate
    
    0 讨论(0)
  • 2020-12-04 05:44

    open the folder with any gitbash console. for example using visualCode and Gitbash console program: 1)Install Gitbash for windows

    2) using VisualCode IDE, right click over the project open in terminal console option

    3) on window console in Visualcode, looking for a Select->default shell and change it for Gitbash

    4)now your project is open with bash console and right path, put source ./Scripts/activate

    btw : . with blank space = source

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