Sharing a virtualenv across several Python projects using Pipenv - The Koch Family
The Koch Family The Koch Family

Latest news

جاري التحميل ...

Sharing a virtualenv across several Python projects using Pipenv


There is a standard library for all projects in Python. However, several projects don’t always have the same dependencies all the time. That is where virtual environments come to play.

You can follow this official document to use two separated tools virtualenv and pip to fulfill that need. My preferred alternative is to use pipenv. Pipenv is easy to use and convenient. The following are my steps to make a shared virtualenv for my all projects which requires the same dependencies.

Step 1. Create an isolated virtualenv.
python -m venv my-shared-env
Step 2. Create a symbolic link to the created virtualenv.
cd project_1
ln -s ~/.local/share/virtualenvs/my-shared-env .venv
I have encountered the following issue at step 1.
FileNotFoundError: [Errno 2] No such file or directory:
'{my_project_path}/.venv/bin/pip': '{my_project_path}/.venv/bin/pip'
The root cause was I tried to create virtualenv by running pipenv install and renaming the generated virtualenv to a new name but forgetting to update the value of $VIRTUAL_ENV at .venv/bin/activate.

Comments



If you like the content of our blog, we hope to stay in constant communication, just enter your email to subscribe to the blog's express mail to receive new blog updates, and you can send a message by clicking on the button next ...

إتصل بنا

About the site

author The Koch Family <<  Welcome! I'm so glad that you stopped by Your Modern Family blog. Together, we will talk about raising kids, organizing the home and saving money! and Tips & tricks and more…

< Learn more ←

Blog stats

Sparkline 2513183

All Copyrights Reserved

The Koch Family

2020