Ask Your Question
1

What is the process to utilize pipenv in order to create a new virtualenv within a subdirectory of an existing virtualenv?

asked 2023-02-11 11:00:00 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-12-08 00:00:00 +0000

david gravatar image

Unfortunately, it is not possible to create a new virtualenv within a subdirectory of an existing virtualenv using pipenv. Each pipenv virtual environment is completely independent of any other virtual environment, and they cannot be nested within each other.

If you want to create a new virtualenv within a subdirectory, you would need to first exit the current virtualenv, create a new virtualenv in the desired subdirectory, and then activate that virtualenv.

Here are the steps to create a new virtualenv within a subdirectory using pipenv:

  1. Navigate to the root directory of your project where your existing virtualenv is located.

  2. Deactivate the current virtualenv if it is currently activated.

pipenv shell
deactivate
  1. Navigate to the subdirectory where you want to create the new virtualenv.
cd subdirectory
  1. Create a new virtualenv using pipenv.
pipenv install
  1. Activate the new virtualenv.
pipenv shell

Now, any packages installed or scripts run within this subdirectory will use the new virtualenv. However, you cannot access or use anything installed in the root virtualenv from within this subdirectory.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-02-11 11:00:00 +0000

Seen: 15 times

Last updated: Dec 08 '22