1

So I wrote some code in python that used the requests library. I am thinking of uploading the files onto github so other people can test out the file. Uploading the main is easy (just one .py) file, but how do I include the requests library?

Is there a way for me to also the requests library along with my .py file so they can immediately run the python file ? or should I tell them to also install requests through pip first?

user3277633
  • 1,891
  • 6
  • 28
  • 48

1 Answers1

1

I suppose you have a folder which you have initialized with git. Now form go to that directory and create a virtual environment by the command,

virtualenv env

activate the virtual environment by the command,

source env/bin/activate

Now install external libraries in it with pip.

pip install requests

Yor python file my.py will be in the same folder where you initialized git using git init. structure will be like,

project
|----env
|    |----bin
|    |----include
|    |----lib
|    |----local
|----my.py

Now you can push the contents of the projcet in your repository with necessary libraries installed in a virtual environment.

salmanwahed
  • 9,450
  • 7
  • 32
  • 55