I have a simple python program that uses numpy, and I want to run it in a remote machine where I cannot install numpy or anything else.
The code needs to run by executing:
python myprogram.py input.txt
How can I add this module as part of my program?
1 Answer 1
Virtualenv allows you to install modules locally, e.g. in the home folder.
Common practice is to maintain the list of requirements in a separate file, e.g. requirements.txt. Deployment looks like this:
virtualenv env_name
env_name/bin/pip install -r requirements.txt
To run your script, simply use env_name/bin/python instead of the system python:
env_name/bin/python myprogram.py input.txt
answered Jan 17, 2017 at 16:01
Marat
15.9k3 gold badges44 silver badges53 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-py