We have multiple Python versions installed into a remote location. /remote/Python-2.7/bin/python
or /remote/Python-2.7.2-shared/linux32/bin/python
etc...... In the code, we use /remote/Python-2.7-shared. I need to use module which is installed in Python-2.7 (like numpy,matplotlib) but not shared location.
In the code we begin Python code like
#! /usr/bin/env py
is it possible to import module from different Python version.?
One suggestion, I got from Google search. We can change the python path at first line of your code.
#! /remote/Python-2.7/bin py
But it also does not have some package which installed in shared and required into code. Could I have input to fix this issue.
I could not understand what is the reason for IT guys to installed multiple version of Python . I can raise ticket also which require lot of approval installing same package in shared location( or In short, no ticket for installing package)
Note. I have tried all option but seems nothing is working. Maybe I am doing mistake. How to import a module given the full path?
Any input will help me lot.
I tried below suggestion But end up with following error. sys.path.inser(0,"path_location")
Traceback (most recent call last):
import numpy
File "/remote/Python-2.7.2/lib/python2.7/site-packages/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/remote/Python-2.7.2/lib/python2.7/site-packages/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/remote/Python-2.7.2/lib/python2.7/site-packages/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
File "/remote/Python-2.7.2/lib/python2.7/site-packages/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/remote/Python-2.7.2/lib/python2.7/site-packages/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: /remote/Python-2.7.2/lib/python2.7/site-packages/numpy/core/multiarray.so: cannot open shared object file: No such file or directory