Distribution of a Python script that depends on the package

I wrote a script that uses Selenium, I installed Selenium via pip. Is there a way I can distribute this script to others without having them to install Selenium via pip?

I watched:

https://pypi.python.org/pypi/selenium#downloads

Would it help me to include the original Selenium distribution from PyPI in the project folder? So that people just need to click on the source distribution install.pyto install Selenium?

+4
source share
2 answers

You can use setuptoolsand use the keyword install_requires.

Like this:

from setuptools import setup

setup(
    # options
    install_requires = ['selenium'],
)

, / pip, .

+4

:

import os
import sys

os.system("python get-pip.py")

try:
    import pip
except ImportError:
    input('Could not install pip, please enter any key to quit this window.')
    sys.exit()


def install(package):
    pip.main(['install', package])

if __name__ == '__main__':
    install('selenium')

, . script, pip selenium, , .

0

All Articles