skip to Main Content

I have been learning python virtual environment and PIPs. I have installed python virtualenv in my ubuntu server using the following steps.

  pip install virtualenv

  ## Checking if its installed
   virtualenv --version    

The file exists in the directory below.
virtualenv 20.16.5 from /home/coyo/.local/lib/python3.8/site-packages/virtualenv/__init__.py
I have specified it to use python3 interpreter

   virtualenv -p /usr/bin/python3 virtualenv_name

The problem comes in whenever i try to activate the virtual environment it throws an error no such file or directory.

   source virtualenv_name/bin/activate

I get this error:
-bash: virtualenv_name/bin/activate: No such file or directory

2

Answers


  1. sometimes the activate file maybe located in another folder such as Scripts

    locate for the ‘activate’ file in the virtualenv folder

    Then try source virtualenv_name/path_to_activate_file

    Login or Signup to reply.
  2. Building on Lamin’s answer. Sometimes the activate file is located elsewhere. To find where it is you can run the following command:

    find . -name activate
    

    Where the . represents the current directory and the -name activate tells find to find a file called activate.

    Once you know the file path you can activate the virtual env normally using

    . virtualenv_name/PATH_TO_ACTIVATE
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search