How to activate an existing virtualenv projects?

Question:

I’m a beginner to Django and Python, and I’ve never used virtualenv before. However, I do know the exact commands to activate and deactivate virtual environments (online search). However, this learning course takes time and sometimes I need to split the work over 2 days.

When I create a virtualenv today and do some work, I’m unable to access the same virtualenv tomorrow. Even when I navigate to that folder and type in .venvScriptsactivate, it says “system cannot find specific path”.

How can I open already existing virtual environments and the projects within them? Could it be that I need to end my previous session in a certain way for me to access it the next time?

Asked By: SonOfEl

||

Answers:

Even though pipenv had so many problems. I suggest you use it when you are new to virtual env.

Just

pip install pipenv
cd $your-work-directory
pipenv shell

Then you created your project env.
You can active it by:

cd $your-work-directory
pipenv shell

You can install packages by:

cd $your-work-directory
pipenv install $yourpackage --skip-lock
Answered By: Xu Qiushi
  1. Open the command prompt
  2. Go to the project directory, where you created virtual environment
  3. And type the same as error shows, as in my case it was

File D:Coding filesPython*recommendation-systemvenvScriptsactivate.ps1* cannot be loaded because running scripts is disabled on this system.

  1. So I typed recommendation-systemvenvScriptsactivate.ps1

And it resolved my problem.

Answered By: Ashutosh Kumar

Use this and it will work:

cd $working directory u have virtual env on

pipenv shell

you can use this command it worked for me for reusing your existing venv

    $ workon then the name of your existing venv
Answered By: Boby Tiwari
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.