How to install python package in directory/folder If do you want to install any python module in your local directory instead of python site-package lib then you have do this. Create a directory/folder sudo mkdir <dir_name> sudo chmod 777 <dir_name> Install package with command sudo pip install boto3 -t <dir_name>/ or sudo pip install -t <dir_name>/ boto3 boto3 will be install inside in <dir_name>/ let suppose your directory is located in /var/www/<dir_name> and your .py file is location in /var/www/<test.py> How to use boto3 package in your test.py file import os path = os . path . dirname ( os . path . realpath ( __file__ )) user_home = os . environ [ "HOME" ] os . environ [ "PYTHONPATH" ] = path + '/<dir_name>' import sys sys . path . append ( path + '/<dir_name>' ) import boto3
Posts
Showing posts with the label How to install python package in local directory