简体   繁体   中英

How can I send my Python Code (Which has pip modules) to a friend who doesn't have Python installed?

I wrote a Text Grammar Checker in Python for a friend of mine. Since he doesn't have Python installed, I searched for ways to get it to him, but there was always a catch. Compiling it to a.exe file doesn't work because it uses a module called pyspellchecker which uses a deprecated module called indexer (At least I think that's why it doesn't work). Another option would be to use an online IDE, but I could find none that could run my code using the modules it uses. Is there any good option left for me or is this a lost cause? I'd really appreciate any help

Here's the source code if required: https://gist.github.com/AaryanGamer/093385d3df463282117edf2021b7cbc2

  • Docker is the 1st option: Docker installation required for your friend.
  • Deploy your script as simple web service is the 2nd option: Your friend need just Browser.
  • The third option that I found convenient for your use case is using PyInstaller , That freezes (packages) Python application into stand-alone executable app.

Documentation link https://www.pyinstaller.org/

My first instinct would be to use a virtual environment ( venv ), and send your friend the whole folder structure. I searched for "venv portable", and the first result - https://aarongorka.com/blog/portable-virtualenv/ - may be what you're looking for if you're both in a Linux environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM