- Settings:
Plain layout without fancy styles
Large fonts
Very large fonts
Restful colour scheme
Light text on a dark background

Note: user account creation on this site has been disabled.

Programming, speculative fiction, science, technology
Powered by Drupal, an open source content management system
Include Children

Everything in the Events vocabulary


People mentioned in the articles


Themes mentioned in the article

Skip to top of page

Creating a virtualenv with Python 3 on Windows 10




Note that wherever the instructions reference the Python path, if you installed a version of Python higher than 3.6, your path to Python 3 probably won't be Python36 -- it will probably end in a different number.

First I installed Python 3. Installation for Windows 10 was straightforward, even though I deviated from the default options in the installation wizard by installing Python for all users (the default is only for your user). This caused it install itself in C:\Program Files\Python36 directory, instead of locally in my user's AppData directory.

Then I ran pip install virtualenv, as recommended in this page on Python virtualenv installation on Windows.

Then I ran the next command the above page tells you to run:

pip install virtualenvwrapper-win

It installed itself. Then I tried to create a virtualenv:

mkvirtualenv SCP3

Ha! It created a virtualenv with Python 2 in it, because I also had Python 2 on my machine! I wanted Python 3, so after some searching I found that you need to pass to mkvirtualenv a path to the Python executable you want it to use.

Being wise in the ways of Windows paths with spaces in them, I tried like this:

mkvirtualenv --python="C:\Program Files\Python36\python" SCP3

where SCP3 is the name of my virtualenv.

Did that work? Nooo! Now it was saying the path C:\Program Files\Python36\python does not exist -- even though I can type C:\Program Files\Python36\python at the command prompt and start the Python interpreter! So it does exist!

Upon further search, this page told me that the command I used was basically correct, except I had to add ".exe" at the end of "python", like this:

mkvirtualenv --python="C:\Program Files\Python36\python.exe" SCP3

(That's actually a virtualenv issue described here).

And there you go -- I got a virtualenv with Python 3!

Note that this "complicated" command is only necessary if you have both Python 2 and Python 3 on your machine. If you only have Python 3, there won't be any other Python executable in your Windows PATH environmental variable, and you can probably run just mkvirtualenv SCP3.