I'm new to Python, but I had a requirement at my work-place. Another programmer is developing a project on Python, Django framework, and my task is to find a way in which this project will be executed at any computer. So, I'm talking about something like Composer for PHP. I need an easiest way that at debian branch to write in terminal a command, that will find kind of "composer.json" file on that project, will read all the required software, modules, libraries and install it step-by-step on PC.
Any ideas how to do it in the easiest way? Thanks.
Pip relies on package authors to stipulate the dependencies for their code in order to successfully download and install the package plus all required dependencies from the Python Package Index (PyPI). But if packages are installed one at a time, it may lead to dependency conflicts.
PIP is a package manager for Python that uses the Python Package Index to install Python packages. PIP will later be used to install Django from PyPI. If you've installed Python 3.4, pip is included so you may skip this section. Open a command prompt and execute easy_install pip . This will install pip on your system.
Since you have not talked about virtual environment, assumed that you already setup the environment and activated it.First get all the libraries lists in requirement.txt file in your project directory by typing below command,
pip freeze > requirements.txt
when you need to setup project in another system just run this
pip install -r requirements.txt
All the dependency will be installed in your project enviornment.
Using pip freeze > requirements.txt
is an anti-pattern. It does some things right, such as pinning version numbers, but it can lead to problems with orphan packages later.
I use pip-tools, this way only your top level dependencies are placed in your requirements.in
file and then I use pip-sync
to sync my local environment with pip.
There's a lot more information on pip best practices in my 2016 Pycon UK talk - Avoiding the "left pad" problem: How to secure your pip install process
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With