-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.

3
  • would this answer help? stackoverflow.com/questions/45293436/… Commented Sep 10, 2018 at 14:25
  • 1
    Which virtual env are you using? You'll need to activate the virutalenv Commented Sep 10, 2018 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. Commented Sep 10, 2018 at 14:40

1 Answer 1

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?

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.