Python Forum

Full Version: Python script with local libraries
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello. I would like to get advise on how to properly create and manage a project with local libraries. For example, I am creating a script that uses mysql.connector library that I have downloaded using pip on my machine. Now imagine someone downloads my program ( .py script as well as Library folder) but he does not have mysql.connector library installed, I would still expect my program to work because It would look for the library locally.

I use Thonny for my programming IDE but I have changed the default interpretter. Instead of using the Thonny Interpreter I use Python 3.10 that I have downloaded from official Python website.

The project structure should be as following:
https://ibb.co/HztxzcB

Could someone clarify how do I exactly import local libraries in my folder and how do I prevent from using the global libraries? If user has installed mysql.connector on his PC, I would still want to use my local library instead of his version because the versions may differ.