Elekam
Elekam

Reputation: 73

VSCode using wrong python path when moving to another workstation

I am trying to make my projects portable because of me working either at my Home PC or Work Laptop. Everything was working fine at my home pc. I moved the project onto a portable drive, aswell as my portable vscode installation (all settings etc in "Data"-Folder).

At my work pc, I could execute my code like normal, but when I wanted to pack my program into an exe file with the installed pyinstaller in the venv, it tries to use my Home-PC python path. However, it uses the correct path to look for pyinstaller.

(venv) PS U:\Programming\Private Projects\in process\Twitter Bot> pyinstaller TwitterBots.py
Fatal error in launcher: Unable to create process using '"e:\desktop\portable files\programming\private projects\in process\twitter bot\venv\scripts\python.exe"  "U:\Programming\Private Projects\in process\Twitter Bot\venv\Scripts\pyinstaller.exe" TwitterBots.py': Das System kann die angegebene Datei nicht finden.

Home-PC-Python-Path: e:\desktop\portable files\programming\private projects\in process\twitter bot\venv\scripts\python.exe

Work-PC/Portable Drive-Python-Path: U:\Programming\Private Projects\in process\Twitter Bot\venv\Scripts\python.exe

Is there any way to change this whenever I switch stations? What exactly is trying to use the wrong path here, so I know where to look?

Upvotes: 0

Views: 1028

Answers (1)

Elekam
Elekam

Reputation: 73

So my error was assuming that the enviroment is portable, which it isn't, and does not make much sense in the first place. At creation the enviroment saves the path to the python exe, so when that path is different on another workstation, of course it does not work.

Like @Panagiotis Kanavos answered: I should have a different enviroment, preferably with the same name, on every workstation. These enviroments should not be included in version control. This works as it should.

Upvotes: 1

Related Questions