I am dynamically importing the numpy package into a python environment of another proprietary system. The top level numpy package gets imported from the right place, but the numpy.random package is pointing to the standard library. Why is this happening?
Code
import sys
LIB_PATH = 'T:\\Some\\Path\\'
if LIB_PATH not in sys.path:
sys.path.insert(0, LIB_PATH)
import numpy
print numpy
print numpy.random
Output
<module 'numpy' from 'T:\Some\Path\numpy\__init__.pyc'>
<module 'random' from 'C:\Python26x64\Lib\random.pyc'>
Why is numpy.random pointing to C:\Python26x64\Lib\random.pyc. When I run this from my standard python interpreter at C:\Python26x64\, then random is indeed the one in the numpy package