Skip to content Skip to sidebar Skip to footer

Terminal Only Running 2.7, Even After Changing Alias

How can I get terminal to run a script like /manage.py where it will use python3 instead of python2? If I type 'python' it runs python3, but this command runs python2.

Solution 1:

The first line of your manage.py should be:

#!/usr/bin/env python3

This is called the shebang and tells your shell which python installation should be used based on which version of python is first in $PATH.

If the first line isn't #!/usr/bin/env python3, it should be. If it is, you should prepend the location of python3 to $PATH.

You'll want to do this by adding the following to your ~/.bashrc:

export PATH="`which python3`:$PATH"

Post a Comment for "Terminal Only Running 2.7, Even After Changing Alias"