1

So I want to send my python script to another computer, nonetheless, it doesn't have the same package installed on it. Is there any way to send the whole python code as a folder which will also include all that packages? ( I have tried creating a virtual environment through the problem relies on the fact that a lot of the code in the virtual environment is made of aliased files which might not exist on the other computer). Thank you very much in advance for your help.

Nazim Kerimbekov
  • 4,712
  • 8
  • 34
  • 58

2 Answers2

0

you can make a requirements.txt file, here will be all your packages from your project, if you have already vitualenv for example to create your requirements.txt execute

pip freeze > requirements.txt

example of requirements.txt

absl-py==0.2.1
amqp==2.3.1
asn1crypto==0.24.0

after this take your all project without your virtualenv, copy to another compure create a new virtualenv, enter in your virtualenv and make

pip install -r requirements.txt

you will have all your packages

Druta Ruslan
  • 7,171
  • 2
  • 28
  • 38
  • Oh I see, what I wanted to know if there is a possibility to directly send everything in a folder? (also is it a good idea to transfer virtual env folders from one computer to an other) Thank you very much – Nazim Kerimbekov Jun 04 '18 at 17:10
  • 2
    no is a bad idea to transfer your virtualenv folder from one computer to another – Druta Ruslan Jun 04 '18 at 17:11
0

Barring the longer process of creating an installable package with a setup.py file, you can place your script in its own folder, then add a pip requirements file. While your virtualenv is active, run the bash/terminal command:

pip freeze > requirements.txt

Ensure that you send the requirements file with the script, and then the recipient can simply run the bash/terminal command (in their own virtualenv, which they hopefully will do)

pip install -r requirements.txt

before running the script.

cosmicFluke
  • 355
  • 1
  • 10