Forums

Activate Virtual Environment Created in Windows in Bash

So I'm on a windows machine so activate my virtual environment using

app_env\Scripts\activate

Now that I have used git to load my files into python anywhere. I'm trying to make sure my virtual environment is working in python anywhere. When I use app_env\Scripts\activate it says command not found.

I tried source app_env/bin/activate (hoping) and that resulted in "Permission denied"

Any idea how I can activate my virtual environment?

(Maybe what I should have ask) I'm trying to deploy my app, and maybe none of this matters. What do I need to make the directory for the Virtualenv? i

Did you upload your virtual environment from your Windows machine? Or did you create a new one on our servers? I ask because virtualenvs aren't portable from machine to machine; you shouldn't keep them in your git repo.

The normal process is to create a completely fresh one on each machine, and then use a requirements.txt file (which does go in the repo) to keep track of which packages you're using -- you can create a requirements file by using pip freeze with your virtualenv activated on your Windows machine -- that will print out all of the stuff that needs to do into it. Then you can add the requirements file to the repo, push/pull it to PythonAnywhere, then create your new env on our systems, activate it, and use pip install -r requirements.txt to install all of the modules you need.

That makes sense, thanks!

source ./env/bin/activate workes when using bash console

Yes, that's the right way to activate a venv.