-1

I have created a virtual environment and on the terminal when every I run the below command, Python3 starts up by default.

$ env/bin/python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 26 2016, 10:49:35) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Can someone tell me how i can get this fixed.

NikhilRcop
  • 89
  • 2
  • 10
  • would this answer help? https://stackoverflow.com/questions/45293436/how-to-specify-python-version-used-to-create-virtual-environment?rq=1 – Demon Sep 10 '18 at 14:25
  • 1
    Which virtual env are you using? You'll need to activate the virutalenv – Scott Skiles Sep 10 '18 at 14:25
  • 1
    Yes, you're explicitly running the version of Python installed in the virtual environment. What's the problem? If you want a different version of Python, don't run the version in the virtual environment. If you want a different version *in* the virtual environment, you need to change how you create it. – chepner Sep 10 '18 at 14:40

1 Answers1

0

In order to keep python from immediately activating like that don’t use “env/bin/python“ instead use “env/bin/activate”

If you wish the environment to be a different version, you must invoke that version during the environment creation. For example, assuming it’s a valid command on your system, use: python2 instead of python or python3.

Here is more information on how to do this: How to specify python version used to create Virtual Environment?

La Fon
  • 145
  • 1
  • 1
  • 9