5

I'm puzzled over the version of Python the gets installed when using mkvirtualenv. Outside of any virtualenv here's what I have.

$ which python 
/opt/local/bin/python    << MacPorts installed Python
$ python -V
Python 2.7.13
$ python -c "import ssl; print ssl.OPENSSL_VERSION"
OpenSSL 1.0.2k  26 Jan 2017

OK so far.

Now, make virtualenv...

$ mkvirtualenv foo
[normal stuff here]
(foo) $ which python
/Users/me/Workspace/venvs/foo/bin/python
(foo)$ python -V
Python 2.7.10

Why is this python 2.7.10? and not python 2.7.13?

$ python -c "import ssl; print ssl.OPENSSL_VERSION"
OpenSSL 0.9.8zh 14 Jan 2016

Where'd this come from?

How can I tell mkvirtualenv which version of Python I'd like to use?

1 Answer 1

7

Use -p (or --python option) to specify python executable path:

mkvirtualenv -p `which python` foo

To be exact, it's virtualenv option. mkvirtualenv passes unknown options to virtualenv directly.

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

1 Comment

mkvirtualenv -p c:\python37\python.exe new_env

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.