2

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

2

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.