Python Forum
Including modules in Python using sys.path.append
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Including modules in Python using sys.path.append
#2
There are no .py files for these type of libraries because they are collections of smaller utilities. In short numpy and pandas are directories. Their functions (.py files) are imported after they are called.

Typically they live under '/site packages' either under C:\Pythonxx\lib or C:\Users\(user)\AppData\Roaming\Python\Python3x\site-packages.

Importing the path must be done within your script, and will only live as long. To make any changes permanent you *must* have C: drive access. In lieu of that, you can install to any dir using:
pip install --install-option="--prefix=$PREFIX_PATH" package_name

HOWEVER: Both packages must be compiled from source, and compiler access may be limited on a worker machine.

The solution I use here on Windows is:
https://www.lfd.uci.edu/~gohlke/pythonlibs/

Where precompiled wheels are offered for Win.

Also, I beleive the correct format for the import dir is:
C:\\Users\\Joe

That said, if as a n00b I am overlooking some obvious subtlety, hopefully someone will correct this bit of advice. I've just installed Python38 on two Win machines with around 5000 packages each, so this kind of stuff is fresh in my head!
Reply


Messages In This Thread
RE: Including modules in Python using sys.path.append - by millpond - Aug-24-2020, 04:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Building a DoublyLinkedList in Python - - append method Drone4four 2 416 Jan-08-2024, 01:27 PM
Last Post: Drone4four
  Function to count words in a list up to and including Sam Oldman45 15 6,552 Sep-08-2023, 01:10 PM
Last Post: Pedroski55
  How to see the date of installation of python modules. newbieAuggie2019 4 1,573 Mar-31-2023, 12:40 PM
Last Post: newbieAuggie2019
  python move specific files from source to destination including duplicates mg24 3 1,096 Jan-21-2023, 04:21 AM
Last Post: deanhystad
  How to modify python script to append data on file using sql server 2019? ahmedbarbary 1 1,215 Aug-03-2022, 06:03 AM
Last Post: Pedroski55
  Python modules for accessing the configuration of relevant paths Imago 1 1,367 May-07-2022, 07:28 PM
Last Post: Larz60+
  Including data files in a package ChrisOfBristol 4 2,538 Oct-27-2021, 04:14 PM
Last Post: ChrisOfBristol
  WebDriverException: Message: 'PATH TO CHROME DRIVER' executable needs to be in PATH Led_Zeppelin 1 2,203 Sep-09-2021, 01:25 PM
Last Post: Yoriz
  Not including a constructor __init__ in the class definition... bytecrunch 3 11,813 Sep-02-2021, 04:40 AM
Last Post: deanhystad
  Python modules to extract data from a graph? bigmit37 5 22,389 Apr-09-2021, 02:15 PM
Last Post: TysonL

Forum Jump:

User Panel Messages

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