Blender 2.78c on CentOS python environment What I am trying to do

Trying to run python modules such as osgeo(GDAL), and others in blender.
  These modules have been installed on the system python environment using pip.

Things i have tried

Deleting blender python environment

Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encoding'


Tried symlinking system python to replace blender python

Tried copying python libraries into blender libraries

Tried both python3.5 and python3.6 - i believe blender uses 3.6

What happens

Regardless of my attempts i get either the module cannot be found or python locale error

Other Information

I am running CentOS 7.  Blender 2.78c from binaries x64(blender.org).

What doesn't makes sense to me is when I install on ubuntu using ppa I don't have this issue.  I am trying to avoid compiling from source if possible for reason i am not going to get into here.

Any help is appreciated.

**Updates**

Installing Pip into blender environment

Pip now working in blenders python environment.  gdal fails to compile with gcc error importing Python.h

Successfully symlinked system python to blender python:

/usr/lib/blender/2.78/python/bin/python3.5m  --&gt; /usr/bin/python3.5m


Blender now runs off system python environment but still does not see gdal

If i run /usr/bin/python3.5m  --> import osgeo : it works 

If i run /usr/lib/blender/2.78/python/bin/python3.5m --> import osgeo : fails to import
If you can, install from system repositories. I've heard that CentOS's isn't very good at this, and on Windows you can't, so here are some other solutions.

The first thing to try is deleting the python folder from the blender install. (you don't need to symlink it, remove it entirely) This should make it use the system python.

The next thing to try is to install pip inside blender. This isn't too hard to do, and is useful in many other cases (eg want a portable version of blender with a specific module)


Download get-pip.py and rename it to get_pip.py
Start blender's python runtime (inside blender/2.78/python/bin/) and run the executable (python3.5m on linux 2.78c) from a terminal.
Add your download folder to the path so python can find get_pip. Do this with:

import sys
sys.path.append('~/Downloads')  # Change path as required

Now you should be able to import get_pip, and run get_pip.main().
Then, to install things, you can use:

import pip
pip.main(['install', 'osgeo'])



You could try it from blender's built in console, but on the windows version this does funny things (like opening lots of instances of blender!),  so I haven't gone into detail.