![]() Note that any changes to the settings.json file will require that you exit the integrated terminal and restart it. The working directory will be your project root. So if any of your scripts do anything with paths relative to their location in the tree, they won't work. I create a default launch.json file to "run the current file". VSCode is a great editor, but everywhere else, it falls short, in my opinion. So my PYTHONPATH needs to be set to ~/project/ (something that P圜harm does automatically). In script.py, I have from modules import mod. My python project is laid out as follows: ~/project/ I want a script to import a module from another directory. I have a situation that I believe is relatively common. PYTHONPATH="/home/tejul/Documents/gr13/default/lib/python2.7:/usr/lib/python2.7", this did not help Using double quotes around the path string, e.g.Restarting VSCode after each change of the.Calling the variable $PYTHONPATH instead of PYTHONPATH, this did not help.home/tejul/Documents/gr13/default/lib/python2.7, this did not help Setting the PYTHONPATH to one folder level higher, i.e.Alas, it has no effect on the python interpreter.Ĭan you see anything that I am doing wrong here? I have also tried: env file in the workspace directory which sets the order of preference for locations from which python should import the modules. I need to let VSCode use my own version of the environment variable $PYTHONPATH which would tell my regular python interpreter to import modules preferably from /home/tejul/Documents/gr13/default/lib/python2.7/dist-packages.įollowing the documentation, I have created my own. So redefining VSCode's python.pythonPath or selecting another python interpreter would not help me. So I need to use VSCode with my normal python interpreter located in /usr/bin/python2.7. It looks like PyBOMBS did not install its own python interpreter into my prefix directory. python.pythonPath is the path to the python interpreter used for debugging or running the code, while $PYTHONPATH is the environment variable which python uses to search for modules. I've been trying to understand the selection of python interpreters, workspaces, and environments for VSCode.Īs far as I understand it, the VSCode workspace setting python.pythonPath is not to be confused with the environment variable $PYTHONPATH. I want to write, run, and debug python scripts for the new version of GNURadio in the VisualStudio Code. Without modifying the $PYTHONPATH python - naturally - imports the older version of GNURadio. Type "help", "copyright", "credits" or "license" for more information. I can use the newer version of GNURadio version only after I run the setup_env.sh script (which - among other things - adds /home/tejul/Documents/gr13/default/lib/python2.7/dist-packages to $PYTHONPATH) and then start python in the terminal lsīin etc include lib libexec setup_env.sh share source python GNURadio version 3.7.13.4 installed by PyBOMBS in /home/tejul/Documents/gr13/default/lib/python2.7/dist-packages/gnuradio (my prefix directory is ~/Documents/gr13/default) GNURadio version 3.7.11 installed by the Linux Mint package manager in /usr/lib/python2.7/dist-packages/gnuradio ![]() I have installed two versions of GNURadio: How do I correctly set up the $PYTHONPATH variable for my workspace in VisualStudio Code?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |