SonOfEl
SonOfEl

Reputation: 177

How to activate an existing virtualenv projects?

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 .\venv\Scripts\activate, 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?

Upvotes: 0

Views: 17141

Answers (4)

Boby Tiwari
Boby Tiwari

Reputation: 1

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

    $ workon then the name of your existing venv

Upvotes: 0

Use this and it will work:

cd $working directory u have virtual env on

pipenv shell

Upvotes: 0

Ashutosh Kumar
Ashutosh Kumar

Reputation: 1

  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 files\Python*recommendation-system\venv\Scripts\activate.ps1* cannot be loaded because running scripts is disabled on this system.

  1. So I typed recommendation-system\venv\Scripts\activate.ps1

And it resolved my problem.

Upvotes: 0

Xu Qiushi
Xu Qiushi

Reputation: 1161

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

Upvotes: 2

Related Questions