问题
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:
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.
来源:https://stackoverflow.com/questions/43664467/how-can-i-tell-mkvirtualenv-which-version-of-python-id-like-to-use