Python Forum
Python script with local libraries
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python script with local libraries
#1
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,279 Jun-29-2023, 11:57 AM
Last Post: gologica
  Adding libraries to embedded Python as a ZIP The_Oman 0 1,246 May-05-2023, 04:05 PM
Last Post: The_Oman
  How to create local copies of Python packages so they do not have to be downloaded okhajut 3 2,038 Sep-29-2020, 02:22 PM
Last Post: buran
  How to kill a bash script running as root from a python script? jc_lafleur 4 5,939 Jun-26-2020, 10:50 PM
Last Post: jc_lafleur
  crontab on RHEL7 not calling python script wrapped in shell script benthomson 1 2,314 May-28-2020, 05:27 PM
Last Post: micseydel
  Installing Python and pointing it to required libraries hooiberg 2 4,322 May-13-2019, 05:55 PM
Last Post: ebolisa
  Package python script which has different libraries as a single executable or script tej7gandhi 1 2,640 May-11-2019, 08:12 PM
Last Post: keames
  python 'SMTP debugging server' not starting local error pcsailor 1 3,460 Nov-26-2018, 10:13 PM
Last Post: micseydel
  Python debugging local os Baggelhsk95 1 2,212 Oct-18-2018, 10:11 AM
Last Post: Gribouillis
  How to run python script which has dependent python script in another folder? PrateekG 1 3,161 May-23-2018, 04:50 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020