No module named env.__main__; 'env' is a package and cannot be directly executed code example

Example 1: No module named env.__main__; 'env' is a package and cannot be directly executed

python -m pip install SomePackage

Example 2: No module named env.__main__; 'env' is a package and cannot be directly executed

python -m pip install SomePackage==1.0.4    # specific version
python -m pip install "SomePackage>=1.0.4"  # minimum version

Example 3: No module named env.__main__; 'env' is a package and cannot be directly executed

python -m pip install --upgrade SomePackage

Example 4: No module named env.__main__; 'env' is a package and cannot be directly executed

py -2   -m pip install SomePackage  # default Python 2
py -2.7 -m pip install SomePackage  # specifically Python 2.7
py -3   -m pip install SomePackage  # default Python 3
py -3.4 -m pip install SomePackage  # specifically Python 3.4

Example 5: No module named env.__main__; 'env' is a package and cannot be directly executed

python2   -m pip install SomePackage  # default Python 2
python2.7 -m pip install SomePackage  # specifically Python 2.7
python3   -m pip install SomePackage  # default Python 3
python3.4 -m pip install SomePackage  # specifically Python 3.4