Permission denied when activating venv

前端 未结 5 1511
臣服心动
臣服心动 2021-01-30 06:25

I just started a new python project and created a venv inside the project folder by running virtualenv venv in the terminal. However, when I run venv/bin/acti

相关标签:
5条回答
  • 2021-01-30 06:40

    From the command line root enter:

    source /home/<your_username>/<app_folder>/<venv_name>/bin/activate
    

    Worked for me

    0 讨论(0)
  • 2021-01-30 06:49

    You need to run

    . venv/bin/activate
    

    or

    source venv/bin/activate
    

    The activate file is deliberately not executable because it must be sourced.

    It must be sourced because it needs to make changes to the environment. If it is run as a script, it will only make changes to the environment of the child process used to run the script.

    Someone in the comments asked about the . command. From the man page for bash:

        .  filename [arguments]
       source filename [arguments]
              Read  and execute commands from filename in the current shell
              environment and return the exit status of the last command
              executed from filename.
    

    In short, . is a shell built-in that means the same thing as the source built-in.

    0 讨论(0)
  • 2021-01-30 06:51

    Basically, it's looking for permission to execute activate on the created folder path.

    On the root give below permissions command on the desired path where activate is located

    sudo chmod -R 755 ~/tensorflow/* # or whatever the target structure 
    

    This will extend all the permissions including Read/Write/Execute and group

    then execute ~/bin/activate

    0 讨论(0)
  • 2021-01-30 06:53

    go to activate file right click and open properties-->permissions

    and check Execute

    open this image:

    0 讨论(0)
  • 2021-01-30 06:59

    On my VSC, I used these and it worked.

    python3 -m venv .venv
    
    source .venv/bin/activate
    
    0 讨论(0)
提交回复
热议问题