#๐Ÿ”’ How to set different python paths for different directories.

17 messages ยท Page 1 of 1 (latest)

hazy lagoon
#

Hello guys, i have a medium-low understanding of python.
So, basically, i am using pyenv right now and i am using different python versions.
I want to use some files in a directory and i set up pyenv so that when i open a cmd in the folder or any subfolder it uses the selected python versions for that folder.
However the problem is that it does not "find" the python command as it says it is not in the PATH.
So, is there a way ti set a specific python for a "custom" PATH for different directories?
For example i want A directory to be able to find A-version of python and use it, while B directory uses B-version of python?
Thx in advance for anyone that answers and excuse me if i reply late since i dont have much tine rn.

P.S. pip works as I use a venv for each directory and idk why but pip works fine at using the right python version.

P.S.2 Someone already tries to solve my problem but i think he misinterpreted since i was not very clear, tho i still thank him for his attempt.
I am not using vs code so i cant just choose and interpreter, also i already setup a venv for pip but idk if i can use is as a python oath as well.
I am trying to use stable diffusion, two different versions trying to use two different python versions.
Since i am using pyenv it does not find python path as with pyenv i can use more than one.
What i need is, if there is one, a way to set a "custom" path for the directory so that one works with python 3.10.9 and the other with the 3.11.0 version.

unreal graniteBOT
#

@hazy lagoon

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

spiral silo
#

one idea is to use virtualenvs.

#

Those don't totally fix your problem, because you have to remember to either "activate" the vritualenv before running commands in that folder, or else to invoke the version of python that's in the folder

hazy lagoon
#

How can I do the second one?

#

I mean how can I put a python version in the folder and then make it work for the whole folder and subfolders? Since it also has subfolders that contain the main file "dependencies" (other python files that are needed by the main one) so i need to like force them use the python version.

#

Btw thx for the reply

#

Also i already am using a venv inside the main folder but Just to install pip packages

#

I also tried putting one of my python versions in the PATH and it works, but only for the stable diffusion that needs this version, for the other one i like need it to access directly to another python version

hazy lagoon
#

so i tried using something like this and at first it works, but when i put another python version inside the system folder it just gives me error

#

system folder

#

python folder

#

this is the environment.bat

#

this is run.bat

unreal graniteBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.