Mr.Geeker
Mr.Geeker

Reputation: 445

python auto install package

i'm facing a problem with python , after i created my script , there is some library i download it and i install it in my ubuntu and i used in my script , now if i give the script to client or any other user maybe he don't know what libraries are there and how to install it , i want an idea to create install.py this file should install all libraries that script need it , is it possible ?

also other question , if i use PYQT is there any way to convert all script to one executable file for mac and windows and linux even they did not install QT ??

Thanks advance .

Fahad

Upvotes: 0

Views: 2067

Answers (1)

user1301404
user1301404

Reputation:

This is a simple bash script for unix that will do your job:

per module:

#!/bin/sh
while read p; do
  pip install $p
done < requirements.txt

or you can simple pass:

pip install -r requirements.txt

in requirements.txt, enter the modules name:

django
numpy
lxml
#.... so on

You can then run the bash script ./script.sh

If you want to do the installation of the modules from your python script, you can use setup:

from setuptools import setup

setup(
    # ...
    install_requires=['module']
)

Upvotes: 1

Related Questions