#! PATH
is shebang and Unix/Linux use it for path for executor. (/path/to/script.py
insted of python /path/to/script.py
)
However, it might help to extend the path in which to look for packages.
Run for your extra enviroment (python bin) this:
# Example:
python -c "import PACKAGE; print(PACKAGE.__path__)"
# Psycopg2
python -c "import psycopg2; print(psycopg2.__path__)"
Output:
['/path/to/some/python/psycopg2']
(My output: /home/usr/miniconda3/envs/free/lib/python3.6/site-packages/psycopg2
)
#!flask/bin/python
from flask import Flask, jsonify
import sys
sys.path.insert(0, '/path/to/some/python') # Without package name
import psycopg2
If you add a path with a package name, you must then be one level down, but beware, __init__.py
files can edit paths through the "namespace" so it's not ideal. But you only work with the package itself. Without it, you work with packages that are available in that directory.