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
Hi all

I was hoping for some advice.

My company has python version 3.5 IDLE.

My company is NOT a software company, i have started using it to automate some of my tasks.

The issue is that modules such as pandas or numpy is not installed and these modules will never be installed (no specific reason was given).

However i have discovered that .py files that are not installed or party of the standard library can be included using the following code:-
import sys
Test is a folder that contains various .py files.

I have pandas installed on my personal computer so I wanted to copy the file from my personal computer into my work computer and put it in the Test folder shown above but i cannot seem to find or

My work computer is heavily restricted, i cannot access the c drive hence why i am trying to find an alternative method.

Any ideas?

Thank you.

I saw youtube video
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:

Where precompiled wheels are offered for Win.

Also, I beleive the correct format for the import dir is:

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!

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python modules to extract data from a graph? bigmit37 6 13,833 Apr-10-2021, 09:29 AM
Last Post: surbhinahta
  Function to count words in a list up to and including Sam Oldman45 13 913 Feb-18-2021, 10:22 AM
Last Post: perfringo
  Where to add own python modules in WinPython? HinterhaeltigesSchlaengelchen 1 381 Jan-21-2021, 07:45 PM
Last Post: snippsat
  how to create pythonic codes including for loop and if statement? aupres 1 434 Jan-02-2021, 06:10 AM
Last Post: Gribouillis
  How to append to a set in Python dgrunwal 7 706 Oct-01-2020, 04:27 PM
Last Post: ndc85430
  Including a Variable In the HTML Tags When Sending An Email JoeDainton123 0 436 Aug-08-2020, 03:11 AM
Last Post: JoeDainton123
  How to append a tuple full of records to a dbf file in Python? DarkCoder2020 4 1,053 May-29-2020, 02:40 PM
Last Post: DarkCoder2020
  Remove from end of string up to and including some character lbtdne 2 723 May-17-2020, 09:24 AM
Last Post: menator01
  Cant Append a word in a line to a list err "str obj has no attribute append Sutsro 2 684 Apr-22-2020, 01:01 PM
Last Post: deanhystad
  how to get PID's of linux commands executed through python modules? Manikandan_PS 4 931 Mar-12-2020, 07:16 AM
Last Post: Manikandan_PS

Forum Jump:

User Panel Messages

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