Short answer - as already mentioned in comments - you need to package your script.
Long answer - I have been there before for the first time - it's annoying. They way Python modules and scripts are packaged is constantly evolving and not all available documentation is being kept up to date. You can easily end up reading recent documentation which, by the time of reading, is already flawed (i.e. obsolete).
The easiest approach, without going down all the way, is a simple file for pip
, which describes your project's dependencies. It's called requirements.txt
. Up-to-date information can be found here.
If this is not enough, you have to package your application. A good but little maintained and somewhat outdated overview / introduction can be found here. It's good for a start, but do NOT try to follow it to the letter! Another OUTDATED manual for beginners commonly cited can be found here. Read it for basic understanding and do NOT try to follow it to the letter.
Once you have come to this point, it's time to read "What the Hell? -- A Journey Through the Nine Circles of Python Packing". It gives a lot of practical advise. The most practical of all: Look at how other projects are doing it and copy-paste it ... ehm ... learn from it.
If you are not scared off by now, I can actually recommend to look at Python module templates. One of the best ones I know of is the "Cookiecutter PyPackage". Its well maintained documentation is available here. If you learned the basics of Python packaging, it's a quick and reliable way of creating all the files and infrastructure required for packaging your code.
Honorable mention: There are tools, which try to streamline the entire process. Number one on my list and also already mentioned in the comments is PyInstaller (manual). Another tool (for Windows), which is usually mentioned, is py2exe (no up-to-date documentation available, AFAIK). Another up-and-coming and promising (yet not production-ready?) tool is Briefcase (documentation). There are more of those, but they all have their issues. There is a good chance you end up reading into the above literature trying to understand those issues ...