If the python version and the module to be installed are different for each project, I think the general (?) Solution is to use pyenv and virtualenv to build the development environment.
I have been python for 1 month so I don't know.
But rather than using pyenv, virtualenv I thought it would be better to create a development environment with docker for each project. I've tried.
Basically, I just run python inside the container I launched for development.
Just prepare a container for each version of the image
I manage the container county that is the development environment for each project Prepare docker-compose.yml.
And in docker-compose.yml, we define a container that runs python apps. Add the following settings to the container where python runs.
python:
volumes:
- ./packages:/root/.local/lib/python2.7/site-packages
My goal is
pip install
will be installed in~ / .local /
with --user
.
This is so that the module
installed with pip
will remain even if the container is deleted.
Why ~ / .local /
instead of the usual site-packages
Synchronizing the host with the regular site-packages
is included in the image from the beginning
Because pip can't be used.
If you want to use vim and jedi-vim for development in python, you can put these packages in sys.path.
Recommended Posts