Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sharing Python virtualenv environments

I have a Python virtualenv (created with virtualenvwerapper) in one user account. I would like to use it from another user account on the same host.

How can I do this? How can I set up virtual environments so as to be available to any user on the host? (Primarily Linux / Debian but also Mac OSX.)

Thanks.

like image 767
chernevik Avatar asked Feb 29 '12 20:02

chernevik


People also ask

Can you share virtual environments Python?

Don't share virtual environments between projects If you have multiple projects that have roughly the same requirements, it might seem like a good idea to create a single virtual environment that both projects can share. Don't do it.

Can I use the same virtual environment for different projects?

Virtual environments are meant to keep things isolated from each other. If one project is a dependency of the other one, then they have to be installed in the same environment. If two projects have dependencies that conflict with each other, then they have to be installed in different environments.

Are Python virtual environments portable?

A virtual environment helps keep your project bundled together with a list of its dependencies. This makes it portable and easy for someone else to open your project and get it up and running without dozens of import errors.


1 Answers

Put it in a user-neutral directory, and make it group-readable.

For instance, for libraries, I use /srv/http/share/ for sharing code across web applications.

You could use /usr/local/share/ for normal applications.

like image 151
Flavius Avatar answered Sep 23 '22 17:09

Flavius