简体   繁体   中英

Python: virtual enviroments using the same modules

I have 10 virtual enviroments for 10 diferent projects, but they have in common many requirements. For example: let say all use pandas .

Question 1: this mean I have 10 pandas pip downloaded occuping storage?

Question 2: for this commonly used requierments wouldn't be a better solution to install at system level ("base")? how do you do this?

Question 3: Is it a crazy idea to create a virtual enviroment with this libraries and use it as a "base" and then set include-system-site-packages = true in pyvenv.cfg ?

What are the good practices?

I'm on macOS and use hombrew python.

Thanks in advance for your insights and experience.

How about you create a docker container for your common packages, and then you just need to apply whatever you are doing on top of that image. Yes you will have 10 images, but only 1 image with pandas for example. So to answer your questions...

Question 1, yes. Question 2, check docker and start using it. Question 3, in line with question 2 if you use docker.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM