diff --git a/doc/check_docs.py b/doc/check_docs.py
index 2d8799341..8ab5fced4 100755
--- a/doc/check_docs.py
+++ b/doc/check_docs.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import sys, glob
 
diff --git a/doc/check_docs2.py b/doc/check_docs2.py
index 8092c6801..ca99a50bf 100755
--- a/doc/check_docs2.py
+++ b/doc/check_docs2.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import os, sys, fnmatch, re
 
diff --git a/doc/conf.py b/doc/conf.py
index 7b9b02ecf..4c7a15c89 100755
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 # -*- coding: utf-8 -*-
 #
diff --git a/doc/ocv.py b/doc/ocv.py
index 4ff8a6deb..8fcef4040 100755
--- a/doc/ocv.py
+++ b/doc/ocv.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
     ocv domain, a modified copy of sphinx.domains.cpp + shpinx.domains.python.
diff --git a/doc/patch_refman_latex.py b/doc/patch_refman_latex.py
index 352c46cb5..ff762fc8f 100755
--- a/doc/patch_refman_latex.py
+++ b/doc/patch_refman_latex.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import sys
 
diff --git a/doc/pattern_tools/gen_pattern.py b/doc/pattern_tools/gen_pattern.py
index 45b45af2d..3643b6d3b 100755
--- a/doc/pattern_tools/gen_pattern.py
+++ b/doc/pattern_tools/gen_pattern.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 """gen_pattern.py
 To run:
diff --git a/doc/pattern_tools/svgfig.py b/doc/pattern_tools/svgfig.py
index bf182a8b0..86afa5913 100755
--- a/doc/pattern_tools/svgfig.py
+++ b/doc/pattern_tools/svgfig.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 # svgfig.py copyright (C) 2008 Jim Pivarski <jpivarski@gmail.com>
 #
diff --git a/doc/reformat.py b/doc/reformat.py
index 00e4aae9e..017efebb3 100755
--- a/doc/reformat.py
+++ b/doc/reformat.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import os, sys, re
 
diff --git a/modules/contrib/doc/facerec/src/create_csv.py b/modules/contrib/doc/facerec/src/create_csv.py
index 71d773c01..c4de778f9 100755
--- a/modules/contrib/doc/facerec/src/create_csv.py
+++ b/modules/contrib/doc/facerec/src/create_csv.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import sys
 import os.path
diff --git a/modules/gpu/misc/mark_nvidia.py b/modules/gpu/misc/mark_nvidia.py
index e8cc3e841..08743fb13 100755
--- a/modules/gpu/misc/mark_nvidia.py
+++ b/modules/gpu/misc/mark_nvidia.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import sys, re
 
diff --git a/modules/java/check-tests.py b/modules/java/check-tests.py
index 4cb80ff72..c4d34f61e 100755
--- a/modules/java/check-tests.py
+++ b/modules/java/check-tests.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import sys, os, re
 
diff --git a/modules/java/generator/gen_java.py b/modules/java/generator/gen_java.py
index c0da34fe0..1da5cb68c 100755
--- a/modules/java/generator/gen_java.py
+++ b/modules/java/generator/gen_java.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import sys, re, os.path
 from string import Template
diff --git a/modules/java/generator/gen_javadoc.py b/modules/java/generator/gen_javadoc.py
index 71372d3a2..dfa591a95 100755
--- a/modules/java/generator/gen_javadoc.py
+++ b/modules/java/generator/gen_javadoc.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import os, sys, re, string, glob
 from optparse import OptionParser
diff --git a/modules/java/generator/rst_parser.py b/modules/java/generator/rst_parser.py
index 33dae447d..d32323a78 100755
--- a/modules/java/generator/rst_parser.py
+++ b/modules/java/generator/rst_parser.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import os, sys, re, string, fnmatch
 allmodules = ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "gpu", "androidcamera", "java", "python", "stitching", "ts", "photo", "nonfree", "videostab", "ocl", "superres"]
diff --git a/modules/python/src2/cv.py b/modules/python/src2/cv.py
old mode 100755
new mode 100644
index 4238d05f7..2d4daf08b
--- a/modules/python/src2/cv.py
+++ b/modules/python/src2/cv.py
@@ -1,3 +1 @@
-#/usr/bin/env python
-
 from cv2.cv import *
diff --git a/modules/python/src2/gen.py b/modules/python/src2/gen.py
index 65cafc990..40879e569 100755
--- a/modules/python/src2/gen.py
+++ b/modules/python/src2/gen.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import sys
 from string import Template
diff --git a/modules/python/src2/gen2.py b/modules/python/src2/gen2.py
index 5061b1147..69a0d369d 100755
--- a/modules/python/src2/gen2.py
+++ b/modules/python/src2/gen2.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import hdr_parser, sys, re, os, cStringIO
 from string import Template
diff --git a/modules/python/src2/hdr_parser.py b/modules/python/src2/hdr_parser.py
index 4c81b04ff..14da8873c 100755
--- a/modules/python/src2/hdr_parser.py
+++ b/modules/python/src2/hdr_parser.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import os, sys, re, string
 
diff --git a/modules/python/test/calchist.py b/modules/python/test/calchist.py
index 0a52258b2..287e22f91 100755
--- a/modules/python/test/calchist.py
+++ b/modules/python/test/calchist.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 # Calculating and displaying 2D Hue-Saturation histogram of a color image
 import sys
diff --git a/modules/python/test/camera_calibration.py b/modules/python/test/camera_calibration.py
index 488dd15c6..8ffc5b1cd 100755
--- a/modules/python/test/camera_calibration.py
+++ b/modules/python/test/camera_calibration.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import sys
 import math
diff --git a/modules/python/test/findstereocorrespondence.py b/modules/python/test/findstereocorrespondence.py
index 8f11738cc..40a9603be 100755
--- a/modules/python/test/findstereocorrespondence.py
+++ b/modules/python/test/findstereocorrespondence.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import sys
 import cv2.cv as cv
diff --git a/modules/python/test/goodfeatures.py b/modules/python/test/goodfeatures.py
index 62907772a..5ccd5b46c 100755
--- a/modules/python/test/goodfeatures.py
+++ b/modules/python/test/goodfeatures.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import cv2.cv as cv
 import unittest
diff --git a/modules/python/test/leak1.py b/modules/python/test/leak1.py
index dde560895..dbd6040a5 100755
--- a/modules/python/test/leak1.py
+++ b/modules/python/test/leak1.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import cv2.cv as cv
 import numpy as np
diff --git a/modules/python/test/leak2.py b/modules/python/test/leak2.py
index af1cb0556..518226448 100755
--- a/modules/python/test/leak2.py
+++ b/modules/python/test/leak2.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import cv2.cv as cv
 import numpy as np
diff --git a/modules/python/test/leak3.py b/modules/python/test/leak3.py
index f72afbbf0..d763c4044 100755
--- a/modules/python/test/leak3.py
+++ b/modules/python/test/leak3.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import cv2.cv as cv
 import math
diff --git a/modules/python/test/leak4.py b/modules/python/test/leak4.py
index dcfc5cfdc..9e5864092 100755
--- a/modules/python/test/leak4.py
+++ b/modules/python/test/leak4.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import cv2.cv as cv
 import math
diff --git a/modules/python/test/precornerdetect.py b/modules/python/test/precornerdetect.py
index 29a6ca1ec..97aa906d4 100755
--- a/modules/python/test/precornerdetect.py
+++ b/modules/python/test/precornerdetect.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import cv2.cv as cv
 
diff --git a/modules/python/test/test.py b/modules/python/test/test.py
index 7c511e4ef..48138cbda 100755
--- a/modules/python/test/test.py
+++ b/modules/python/test/test.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import unittest
 import random
diff --git a/modules/python/test/test2.py b/modules/python/test/test2.py
index 703d2ed74..a96be4f6b 100644
--- a/modules/python/test/test2.py
+++ b/modules/python/test/test2.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import unittest
 import random
diff --git a/modules/python/test/ticket_6.py b/modules/python/test/ticket_6.py
index 533027f5b..7249ff2c7 100755
--- a/modules/python/test/ticket_6.py
+++ b/modules/python/test/ticket_6.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import urllib
 import cv2.cv as cv
diff --git a/modules/python/test/tickets.py b/modules/python/test/tickets.py
index 1e756bcd8..de51e7aa1 100755
--- a/modules/python/test/tickets.py
+++ b/modules/python/test/tickets.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import unittest
 import random
diff --git a/modules/python/test/transformations.py b/modules/python/test/transformations.py
index 1f63bcef2..5dce6b049 100755
--- a/modules/python/test/transformations.py
+++ b/modules/python/test/transformations.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 # -*- coding: utf-8 -*-
 # transformations.py
diff --git a/modules/ts/misc/testlog_parser.py b/modules/ts/misc/testlog_parser.py
index f61b47bba..7ae6aa598 100755
--- a/modules/ts/misc/testlog_parser.py
+++ b/modules/ts/misc/testlog_parser.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import sys, re, os.path
 from xml.dom.minidom import parse
diff --git a/samples/python2/_coverage.py b/samples/python2/_coverage.py
index 1d0f0418b..80edffb99 100755
--- a/samples/python2/_coverage.py
+++ b/samples/python2/_coverage.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Utility for measuring python opencv API coverage by samples.
diff --git a/samples/python2/_doc.py b/samples/python2/_doc.py
index 71c9faa7d..fe2b6f32b 100755
--- a/samples/python2/_doc.py
+++ b/samples/python2/_doc.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Scans current directory for *.py files and reports
diff --git a/samples/python2/asift.py b/samples/python2/asift.py
index 09894dd4c..61fca80fb 100755
--- a/samples/python2/asift.py
+++ b/samples/python2/asift.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Affine invariant feature-based image matching sample.
diff --git a/samples/python2/browse.py b/samples/python2/browse.py
index da2c98d1c..1ea31c0b6 100755
--- a/samples/python2/browse.py
+++ b/samples/python2/browse.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 browse.py
diff --git a/samples/python2/calibrate.py b/samples/python2/calibrate.py
index 54aba8aaf..11ab813f5 100755
--- a/samples/python2/calibrate.py
+++ b/samples/python2/calibrate.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import numpy as np
 import cv2
diff --git a/samples/python2/camshift.py b/samples/python2/camshift.py
index 43543dcfc..4ce005b87 100755
--- a/samples/python2/camshift.py
+++ b/samples/python2/camshift.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Camshift tracker
diff --git a/samples/python2/coherence.py b/samples/python2/coherence.py
index 082a7c610..d2de154c0 100755
--- a/samples/python2/coherence.py
+++ b/samples/python2/coherence.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Coherence-enhancing filtering example
diff --git a/samples/python2/color_histogram.py b/samples/python2/color_histogram.py
index c27744ed5..ebb4b642d 100755
--- a/samples/python2/color_histogram.py
+++ b/samples/python2/color_histogram.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import numpy as np
 import cv2
diff --git a/samples/python2/common.py b/samples/python2/common.py
index 4c6f800c4..f3c41018a 100755
--- a/samples/python2/common.py
+++ b/samples/python2/common.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 This module contais some common routines used by other samples.
diff --git a/samples/python2/contours.py b/samples/python2/contours.py
index daa13b2a1..f8cc12c0c 100755
--- a/samples/python2/contours.py
+++ b/samples/python2/contours.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 This program illustrates the use of findContours and drawContours.
diff --git a/samples/python2/deconvolution.py b/samples/python2/deconvolution.py
index 5e3becc64..e9c4f44d1 100755
--- a/samples/python2/deconvolution.py
+++ b/samples/python2/deconvolution.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Wiener deconvolution.
diff --git a/samples/python2/demo.py b/samples/python2/demo.py
index a9c107015..068d1eef6 100755
--- a/samples/python2/demo.py
+++ b/samples/python2/demo.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Sample-launcher application.
diff --git a/samples/python2/dft.py b/samples/python2/dft.py
index 32a91e3b5..73df84dc9 100644
--- a/samples/python2/dft.py
+++ b/samples/python2/dft.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import cv2
 import numpy as np
diff --git a/samples/python2/digits.py b/samples/python2/digits.py
index c84bc241c..e68ec0461 100755
--- a/samples/python2/digits.py
+++ b/samples/python2/digits.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 SVM and KNearest digit recognition.
diff --git a/samples/python2/digits_adjust.py b/samples/python2/digits_adjust.py
index 72805d3f0..314731010 100755
--- a/samples/python2/digits_adjust.py
+++ b/samples/python2/digits_adjust.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Digit recognition adjustment.
diff --git a/samples/python2/digits_video.py b/samples/python2/digits_video.py
index ef62826fd..473d54560 100755
--- a/samples/python2/digits_video.py
+++ b/samples/python2/digits_video.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import numpy as np
 import cv2
diff --git a/samples/python2/distrans.py b/samples/python2/distrans.py
index 386ea8ab9..fc2e3d177 100755
--- a/samples/python2/distrans.py
+++ b/samples/python2/distrans.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Distance transform sample.
diff --git a/samples/python2/edge.py b/samples/python2/edge.py
index 9ce3457d3..4abc94255 100755
--- a/samples/python2/edge.py
+++ b/samples/python2/edge.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 This sample demonstrates Canny edge detection.
diff --git a/samples/python2/facedetect.py b/samples/python2/facedetect.py
index 27a78950a..5154711d2 100755
--- a/samples/python2/facedetect.py
+++ b/samples/python2/facedetect.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import numpy as np
 import cv2
diff --git a/samples/python2/feature_homography.py b/samples/python2/feature_homography.py
index 4dd8ddf13..a9e0d3218 100755
--- a/samples/python2/feature_homography.py
+++ b/samples/python2/feature_homography.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Feature homography
diff --git a/samples/python2/find_obj.py b/samples/python2/find_obj.py
index 7a875ca4f..66c971dd2 100755
--- a/samples/python2/find_obj.py
+++ b/samples/python2/find_obj.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Feature-based image matching sample.
diff --git a/samples/python2/fitline.py b/samples/python2/fitline.py
index c19dbdc35..5960f2c85 100755
--- a/samples/python2/fitline.py
+++ b/samples/python2/fitline.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Robust line fitting.
diff --git a/samples/python2/floodfill.py b/samples/python2/floodfill.py
index 177e38025..33978c158 100755
--- a/samples/python2/floodfill.py
+++ b/samples/python2/floodfill.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Floodfill sample.
diff --git a/samples/python2/gabor_threads.py b/samples/python2/gabor_threads.py
index 9582bdb04..7b8766eb5 100755
--- a/samples/python2/gabor_threads.py
+++ b/samples/python2/gabor_threads.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 gabor_threads.py
diff --git a/samples/python2/gaussian_mix.py b/samples/python2/gaussian_mix.py
index de714fa35..704d30cf6 100755
--- a/samples/python2/gaussian_mix.py
+++ b/samples/python2/gaussian_mix.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import numpy as np
 from numpy import random
diff --git a/samples/python2/hist.py b/samples/python2/hist.py
index 47fdb56bb..1f32b0e07 100755
--- a/samples/python2/hist.py
+++ b/samples/python2/hist.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 ''' This is a sample for histogram plotting for RGB images and grayscale images for better understanding of colour distribution
 
diff --git a/samples/python2/inpaint.py b/samples/python2/inpaint.py
index d2b8c849a..8e91406bc 100755
--- a/samples/python2/inpaint.py
+++ b/samples/python2/inpaint.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Inpainting sample.
diff --git a/samples/python2/kmeans.py b/samples/python2/kmeans.py
index 4418a4679..0656fa7ad 100755
--- a/samples/python2/kmeans.py
+++ b/samples/python2/kmeans.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 K-means clusterization sample.
diff --git a/samples/python2/lappyr.py b/samples/python2/lappyr.py
index 232ec54b9..550136262 100755
--- a/samples/python2/lappyr.py
+++ b/samples/python2/lappyr.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 ''' An example of Laplacian Pyramid construction and merging.
 
diff --git a/samples/python2/letter_recog.py b/samples/python2/letter_recog.py
index 73eeff3bb..ef8c7229c 100755
--- a/samples/python2/letter_recog.py
+++ b/samples/python2/letter_recog.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 The sample demonstrates how to train Random Trees classifier
diff --git a/samples/python2/lk_homography.py b/samples/python2/lk_homography.py
index 9996764c6..5f6389755 100755
--- a/samples/python2/lk_homography.py
+++ b/samples/python2/lk_homography.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Lucas-Kanade homography tracker
diff --git a/samples/python2/lk_track.py b/samples/python2/lk_track.py
index f0d043962..794cb1003 100755
--- a/samples/python2/lk_track.py
+++ b/samples/python2/lk_track.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Lucas-Kanade tracker
diff --git a/samples/python2/morphology.py b/samples/python2/morphology.py
index 098098138..99e63444e 100755
--- a/samples/python2/morphology.py
+++ b/samples/python2/morphology.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Morphology operations.
diff --git a/samples/python2/mosse.py b/samples/python2/mosse.py
index aecb42345..671b33fc7 100755
--- a/samples/python2/mosse.py
+++ b/samples/python2/mosse.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 MOSSE tracking sample
diff --git a/samples/python2/motempl.py b/samples/python2/motempl.py
index 4f78ebad5..3ded78e4b 100755
--- a/samples/python2/motempl.py
+++ b/samples/python2/motempl.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import numpy as np
 import cv2
diff --git a/samples/python2/mouse_and_match.py b/samples/python2/mouse_and_match.py
index a9fa882ad..b55b00266 100755
--- a/samples/python2/mouse_and_match.py
+++ b/samples/python2/mouse_and_match.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 #!/usr/bin/env python
 '''
diff --git a/samples/python2/mser.py b/samples/python2/mser.py
index 73e0a4f8d..d640ea4b8 100755
--- a/samples/python2/mser.py
+++ b/samples/python2/mser.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 MSER detector demo
diff --git a/samples/python2/opt_flow.py b/samples/python2/opt_flow.py
index d0bc5c5c1..b476b0142 100755
--- a/samples/python2/opt_flow.py
+++ b/samples/python2/opt_flow.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import numpy as np
 import cv2
diff --git a/samples/python2/peopledetect.py b/samples/python2/peopledetect.py
index f4bd46702..f8d5e6fd0 100755
--- a/samples/python2/peopledetect.py
+++ b/samples/python2/peopledetect.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 import numpy as np
 import cv2
diff --git a/samples/python2/plane_ar.py b/samples/python2/plane_ar.py
index dc2d5d584..4b12dfe9d 100755
--- a/samples/python2/plane_ar.py
+++ b/samples/python2/plane_ar.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Planar augmented reality
diff --git a/samples/python2/plane_tracker.py b/samples/python2/plane_tracker.py
index 189f50b36..4b7d3959c 100755
--- a/samples/python2/plane_tracker.py
+++ b/samples/python2/plane_tracker.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Multitarget planar tracking
diff --git a/samples/python2/squares.py b/samples/python2/squares.py
index a247c3562..36676b454 100755
--- a/samples/python2/squares.py
+++ b/samples/python2/squares.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Simple "Square Detector" program.
diff --git a/samples/python2/stereo_match.py b/samples/python2/stereo_match.py
index 0e46c2661..0803a3d12 100755
--- a/samples/python2/stereo_match.py
+++ b/samples/python2/stereo_match.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Simple example of stereo image matching and point cloud generation.
diff --git a/samples/python2/texture_flow.py b/samples/python2/texture_flow.py
index 66eb58fe6..8b20faf4c 100755
--- a/samples/python2/texture_flow.py
+++ b/samples/python2/texture_flow.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Texture flow direction estimation.
diff --git a/samples/python2/turing.py b/samples/python2/turing.py
index 101f22c04..e847f014c 100755
--- a/samples/python2/turing.py
+++ b/samples/python2/turing.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Multiscale Turing Patterns generator
diff --git a/samples/python2/video.py b/samples/python2/video.py
index 2cdcb2a60..7e90ded03 100755
--- a/samples/python2/video.py
+++ b/samples/python2/video.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Video capture sample.
diff --git a/samples/python2/video_dmtx.py b/samples/python2/video_dmtx.py
index 1ed06c4ad..bcb578574 100755
--- a/samples/python2/video_dmtx.py
+++ b/samples/python2/video_dmtx.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Data matrix detector sample.
diff --git a/samples/python2/video_threaded.py b/samples/python2/video_threaded.py
index 6fce33418..7bead033c 100755
--- a/samples/python2/video_threaded.py
+++ b/samples/python2/video_threaded.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Multithreaded video processing sample.
diff --git a/samples/python2/watershed.py b/samples/python2/watershed.py
index d4ab22ad5..9740e3889 100755
--- a/samples/python2/watershed.py
+++ b/samples/python2/watershed.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python
+#!/usr/bin/env python
 
 '''
 Watershed segmentation