Reputation: 3
I'm currently working on a python project and am trying to allow a user to run a 'setup' type file that will automatically install modules such as pyserial etc. for them very easily. I don't want to give them a text file with info such as:
pip install module_name
and ask them to copy and paste this into terminal. Any suggestions on how I could make the installations tidy and minimalist?
Thanks!
Upvotes: 0
Views: 117
Reputation: 182
You can use pip freeze or generate the file yourself.
Examples Generate output suitable for a requirements file.
$ pip freeze
docutils==0.11
Jinja2==2.7.2
MarkupSafe==0.19
Pygments==1.6
Sphinx==1.2.2
Generate a requirements file and then install from it in another environment.
$ env1/bin/pip freeze > requirements.txt # Generate the file
$ env2/bin/pip install -r requirements.txt # Install the requirements
For more info please visit: https://pip.pypa.io/en/stable/reference/pip_freeze/
If you are using setup_tools you can also use a requirements file like this: https://packaging.python.org/discussions/install-requires-vs-requirements/
install_requires=[
'A>=1',
'B>=2'
]
This should be in your setup.py.
Upvotes: 1