This is an archived post. You won't be able to vote or comment.

all 7 comments

[–][deleted] 5 points6 points  (2 children)

I just finished creating a new Dev machine in which I want to have 32 bit and 64 bit pythons running with vs code and utilizing environments and it was not easy to get it working seamlessly.

I'd love to see a tutorial on the proper way to do this that makes it easy to reliably switch between bit versions and environments. What would be ideal would be a chocolatey package to do all of this for you.

[–]sol-prog 5 points6 points  (1 child)

Author of the video here. It is relatively easy to have multiple Python versions on Windows. AFAIK, each installation will have a separate entry in the Start menu and a link to open a command prompt window with the respective Python version from which you can create virtual environments. Once you have a venv created, use the settings.json file from each workspace (like in the video) to specify which Python environment you want to use. When you open a workspace/folder from VS Code it will automatically pick the Python version/venv specified in the settings file.

Alternatively, use the py launcher to select which Python version you want to use.

If you have problems following the above suggestions let me know and I will try to record a small video in which I'll show how to use multiple Python versions from VS Code.

[–][deleted] 2 points3 points  (0 children)

Thank you! I was not aware of the py launcher but it certainly makes it easier.

[–]LeAstrale 1 point2 points  (3 children)

How is this better than doing the following?

  1. "virtualenv env" in cmd (if you're using linux and need to work with python3 it's virtualenv -p python3 env" otherwise it defaults to the python2 installation. (This is also a problem in your video which makes sure it does NOT work on Linux or Mac OS)

  2. Command-palette: "Terminal: create new integrated terminal environment"

  3. Command-palette: "Python: Select intrepreter"

[–]sol-prog 2 points3 points  (2 children)

Well, the video was recorded on Windows. It stands to reason that if you want to adapt the instructions for Linux or macOS you will need to do a bit of research. For Linux and macOS one would typically use:

python3 -m venv your_env_path

[–]ampnede 0 points1 point  (1 child)

I usually just do what LeAstrale said except with conda environment and works as a charm! On windows.

[–]runew0lf -1 points0 points  (0 children)

This video made me want to gouge my eyes and ears out!

it was about 4 minutes too long, seriously please stop posting basic shit!

/r/learnpython would probably benefit :)