DEV Community

Cover image for How to work with Python's normal venv and pipenv simultaneously
Shrikant Dhayje
Shrikant Dhayje

Posted on • Originally published at codewithshriekdj.netlify.app on

How to work with Python's normal venv and pipenv simultaneously

Why Need to solve this issue.

So I Just Want to Use pipenv but do not want my venv folder to built in my automatically decided location and also want to use pipenv automatically building the requirements list.

So For Resolving this issue I build a method of how to do that.

Straight to the Point The Steps are given below.

Create Virtual Environment normally with venv module

For Windows

py -3 -m venv venv_folder
Enter fullscreen mode Exit fullscreen mode

For Linux or Mac Operating System

python -m venv venv_folder
Enter fullscreen mode Exit fullscreen mode

or

python3 -m venv venv_folder
Enter fullscreen mode Exit fullscreen mode

Activate the manually created virtual environment folder

For Windows

# for windows powershell
./venv_folder/Scripts/Activate.ps1

# for windows cmd
./venv_folder/Scripts/activate.bat

# for windows with posix shell like git bash cli
source venv_folder/Scripts/activate
Enter fullscreen mode Exit fullscreen mode

For Linux Based operating system or MacOS

source venv_folder/bin/activate
Enter fullscreen mode Exit fullscreen mode

if you have any issues activating the venv please refer below post

Install pipenv twice

Install the pipenv like given below

pip install pipenv

pipenv install pipenv
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Installing pipenv...
...
Enter fullscreen mode Exit fullscreen mode

Now install packages with pipenv as normal

You will now have pipenv and venv_folder both at the same time to run it.

Top comments (0)