0

I have just started using python and pycharm, and I have a windows laptop and a mac where I need to work from. In specific, I created a project including a venv in my windows laptop which is uploaded in one drive and works perfectly for that laptop. So my question is; can I work on that same project from my mac?

Instinctively my answer would be no, because all the virtual environment files originally created in the windows venv are .exe which are incompatible with anything mac related. Trying to open the project and load the interpreter myself has confirmed that this doesn't work.

But then I stumbled on to this post, which would suggest that this person can run a project from a windows and linux OS with the only problem being that they only have to re-select the interpreter.

So is there any way that the above can be done, or a workaround at least? (e.g. creating two venvs for each OS or something).

kostas1335
  • 59
  • 1
  • 6

1 Answers1

1

Yes, you can run the same Python code on both Windows and Mac. You will need to create separate virtual environments on each because the Python interpreter is a .exe file on Windows and something else on Mac.

I suggest that you use git to track changes in your code. Then you can push your code to a service such as GitHub so that your changes are avaialble on all of your computers. You won't add the virtual environments to the git repository, though. These should be created separately on each machine where you want to work on your project.

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
  • yes, that sounds reasonable. But pycharm does not let me create two virtual environments for the same project, so what's your advice for this case? – kostas1335 Oct 30 '20 at 17:37
  • 1
    @kostas1335 You don't need to create two virtual environments for the same project. You set up your pycharm project on each machine to use the virtual environment on that machine. – Code-Apprentice Oct 30 '20 at 20:25