Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

I'm wondering if there's a way of creating a virtualenv with mkvirtualenv using an specific python version rather the than the latest one (3.11).

I have /opt/homebrew/bin/python3.[8-11] and sometimes I want to create an virtualenv with python 3.8.

I tried export VIRTUALENVWRAPPER_PYTHON=/opt/homebrew/bin/python3.8 before doing mkvirtualenv ... but that does not work, or it's not enough.

You must be logged in to vote

Replies: 4 comments

Comment options

The solution I have for the moment is, if I need, say Python 3.9, I do: pip3.9 install virtualenvwrapper and then create the env.

You must be logged in to vote
0 replies
Comment options

virtualenv accepts a --python argument. You should be able to add --python=/path/to/interpreter to your command line to mkvirtualenv and have it pass through.

You must be logged in to vote
0 replies
Comment options

To be honest, I never used virtualenv per se, always virtualenvwrapper. I tried to look for an option but when I do mkvirtualenv --help, I see mentions to what you say, but I frankly didn't try because, otherwise, I love virtualenvwrapper precisely because it's simple and straightforward to use.

You must be logged in to vote
0 replies
Comment options

I see that this is a very old discussion, but since it's still open and just in case someone else wonders if this is possible:

mkvirtualenv -a /path/to/your/project/folder -p python3.8 <new_env_name>
mkvirtualenv --python=/path/to/python3.8 <new_env_name>

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.