0

I already knew that python will find packeges from directories listed in "sys.path"

If i want to import a package from "media", i will just type the following code:

import sys
sys.append('/media')

Apparently, it's not a correct way to import package from arbitrary directory.

So my first question is how to import package from arbitrary directory correctly?

When i type

pip install something

In my opinion, it just download packages from mirror site. But where did it put the packages?

When i use jupyter notebook to type code

import numpy as np

it does not work though i have installed it correctly. As sonn as i change jupyter kernel, it works.

So different jupyter kernel will find packages by using different directories. How to set it ?

I know my description is a little confusing.Because my mind is confused now.If possible, could you help me sort out the relevant knowledge.

zo Aoo
  • 21
  • 4
  • Take a look at [How do I find the location of my Python site-packages directory?](https://stackoverflow.com/q/122327/674039) – wim Oct 14 '22 at 05:24

0 Answers0