简体   繁体   English

如果我使用pip安装模块,如何确保其他人可以在不安装该模块的情况下运行我的程序?

[英]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? 我正在制作一个使用PyMySql的程序,我希望人们能够在不手动安装PyMySql的情况下运行我的程序,有什么方法可以实现?

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. 我已经尝试过编译为.pyc了,但这似乎不起作用,实际上,当我卸载PyMySql时,它不再起作用了。

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 PS:可能有更好的语言可以做到这一点,但这是学校的一项家庭作业,除python外什么也不能使用,也为我的英语不好对不起

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. 由于PyMySQL具有MIT许可证,因此您可以在没有任何法律问题的情况下重新分发它,并且它是纯python实现,因此在哪个操作系统上运行都无关紧要。

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. 只需转到python库文件夹并查找module文件夹,然后将其复制到您的项目文件夹中,然后即可卸载,并且python应该能够从您的项目文件夹中将其导入,您只需要发送包含模块的作业即可。

The python library folder varies depending on your operative system, you can look at this answer on how to find the module location. python库文件夹根据您的操作系统而有所不同,您可以查看有关如何找到模块位置的答案

Use cx_freeze, pyinstaller or virtualenv. 使用cx_freeze,pyinstaller或virtualenv。 Or copy code and put in your. 或复制代码并放入您的代码中。 Read python import 阅读python import

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在我的python脚本中包含pip安装的模块? - How can I include a pip installed module with my python script? 我怎样才能确定我在Mac OSX上正确安装了pip? - How can I be sure I installed pip correctly on Mac OSX? 我无法安装 Urllib 模块所有其他模块都可以轻松安装,但这给了我错误 - I Cannot install Urllib Module all other modules can be installed easily but this gave me error 如何使pip将软件包安装到PATH? - How can i make pip install my package to PATH? 如何让我的 python 程序在新计算机上自动安装模块? - How can I make my python program install modules automatically on new computers? 通过pip安装IPython后如何运行IPython - How can I run IPython after I installed it via pip 如何在没有ROOT ACCESS的情况下安装python模块YAML('easy_install'和'pip'不可用)? - How can I install the python module YAML without ROOT ACCESS ( 'easy_install' and 'pip' are not available)? 如何将内核安装到我的 Jupyter Notebook 以运行 Python 2.7(已通过 Anaconda3 安装了 Python 3.6) - How can I install a kernel to my Jupyter Notebook to run Python 2.7 (having installed Python 3.6 via Anaconda3) 在我安装 anaconda 后没有新的 pip 安装的模块可以导入 - after I installed anaconda no new pip installed modules can be imported 如何确保Windows Update软件包已成功安装 - How can I make sure the windows update package installed successfully
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM