0

I want to set PYTHONPATH and python interpreter according to projects I am working on. I am working both on projects involving python 2.0, and ones involving python 3.0.

There is the concept of workspaces in coc, but I don't really understand it. What happens is that it asks me for interpreter every time I open the same file. (It asks in menu and after I pick a suitable choise it is OK)

So, how should I do it? i.e. is there a configuration file for a project(where is it located, what to write) ? can it identify the use of print "asdas" vs print("asdaa") and thus determine the python version? How do you handle this problem?

  • An outside-of-vim solution would be to use virtual environments. – D. Ben Knoble Aug 10 at 18:26
  • Your question as it stands is probably too broad... Can you please include what you have tried and why it didn't work as you expected? What kind of Python projects are you working on, are you writing Python modules or web apps? Are you already using some kind of virtual environment manager for Python, and if so, which? What are the details of your environment (OS, Python version, NeoVim version, other relevant information)? – filbranden Aug 11 at 3:25
  • When you say "it asks me for the interpreter every time I open the same file", how does it ask you for that information, with a prompt? Or a menu? Does answering a specific option result in a successful setup, are you just trying to make that choice permanent? Or make it permanent for a specific project? – filbranden Aug 11 at 3:27
  • I tried to be more specific. I didn't try anything yet, though I am thinking of writing some code in which it could determine the version by hints(/list maybe). It just seems like a too common situation. I want to make the choice permanent for a certain file/workspace. – eyal karni Aug 13 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.