Execute python 3 not python 2
<p>I have installed python 2 after installing python 3.And now when I executing my python file by clicking on file (not by cmd) its run python 2 ,but I want python 3.
I have tried script:</p>

<pre><code>import sys
print (sys.version)
</code></pre>

<p>output was:</p>

<pre><code>2.7.11
</code></pre>

<p>Can someone help me to make python 3 default on my pc. So when i run my file,it execute Python 3.
Sorry for bad English.</p>

<p>Assuming you have python3 installed, you can us <a href="https://docs.python.org/3/using/scripts.html" rel="nofollow">virtual environment mechanisms</a> built into python3 to prevent errors just like this. </p>

<p>I saw in the comments you are using Windows, so the following steps to ensure that you are using the intended version of Python every time.</p>

<p>first navigate to your projects directory and run the command:
<code>c:\Temp&gt;c:\Python35\python -m venv myenv</code>. This will create a directory <code>myenv</code> with scripts to create your virtual enviroment.</p>

<p>Next activate your virtual enviroment with the command:
<code>C:\&gt; .\myenv\Scripts\activate.bat</code>. This will change your environment to what is set in the virtual environment.   </p>

<p>Now run the command <code>python</code> to see that python 3.5 is being run.</p>

<p>to exit the virtual environment just run <code>deactivate.bat</code> </p>

python python-2.7 python-3.4