简体   繁体   中英

If I install modules with pip, how can I make sure other people can run my program without having that module installed?

I'm making a program that uses PyMySql and I'd like people to be able to run my program without going through the manual installation of PyMySql, is there a way I can achieve that?

I've already tried compiling to .pyc but that doesn't seem to work, in fact when I uninstall PyMySql it doesn't work anymore.

PS: There probably are better languages to do that but it's a homework assignment for school and can't use anything but python, also sorry for my bad english

Since PyMySQL has MIT license, you can redistribute it without any legal issues and also is a pure python implementation so it doesn't matter on which operative system it runs.

Just go to your python library folder and look for the module folder and copy it to your project folder, after that you can uninstall and python should be able to import it from your project folder and you just need to send your assignment with the module included.

The python library folder varies depending on your operative system, you can look at this answer on how to find the module location.

Use cx_freeze, pyinstaller or virtualenv. Or copy code and put in your. Read python import

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