1

I have been programming in Python using Spyder in combination with virtual environments for a while now. Before I started using virtual envs, I installed Spyder using pip. I am not very familiar with paths and environments, but this seemed the way to go when I repetitively ran into package compatibility issues. However, it has been bugging me that every time I want to switch environment, I need to change the working directory to the folder of the environment and I need to change the Python interpreter manually within Spyder.

When I was looking for a solution, I found that it is possible to install Spyder within a virtual environment. I did this and found out that opening Spyder from a virtual environment has the exact same working directory and interpreter as the standalone version (the one I started with). This means that I still have to change the interpreter and working directory manually... Am I doing something wrong or is the only way to switch environments by changing it in the preferences tab within Spyder?

Background info: Using Windows, Spyder 4.2.1, venv as described on https://docs.python.org/3/tutorial/venv.html

Hendrik777
  • 11
  • 2
  • Have you considered using conda package manager? I use it, and it's snap to switch between environments on Windows. My base is Python 3,8, and I have a games environment at 3.6. The Start menu has 1) Spyder (py 3.8), 2) Spyder (py 3.6), 3) Anaconda shell prompt (py 3.8) and 4) Anaconda shell prompt (py 3.6) , plus options for Jupyter Notebook and Powershell. It's a no-brainer to pick the environment you want. – kcw78 Mar 19 '21 at 00:28
  • Earlier I used conda. However, it happened quite a few times that I could not install the latest package version via conda. From your answer I understand that it is easier to switch between environments using conda, so I will look into it. Thanks! – Hendrik777 Mar 19 '21 at 09:07

0 Answers0