Reputation: 2428
I am currently running python programs in virtualenv but how can I run using visual studio code especially when run/debug is clicked. (Ubuntu)
First I need to be inside the environement this is what I run from terminal source ~/home/python/bin/activate and then python test.py where python is pointing to python3.5 in virtualenv
Basically I want to debug by using breakpoints.
Upvotes: 5
Views: 4327
Reputation: 36
please edit launch.json Add Configuration
{
"name": "Attach (Remote Debug)",
"type": "python",
"request": "attach",
"localRoot": "${workspaceRoot}",
"remoteRoot": "${workspaceRoot}",
"port": 3000,
"secret": "my_secret",
"host": "localhost"
},
Follow link: https://code.visualstudio.com/docs/editor/debugging
Upvotes: 2
Reputation: 301
Here is explained how you can run Visual Studio Code with Python https://code.visualstudio.com/docs/languages/python
EDIT1:
Windows - Python Virtual Environment And PYTHONPATH with Visual Studio Code: https://www.youtube.com/watch?v=AfvuK7US_9s
EDIT2: Ubuntu - http://dacrook.com/setting-up-python-and-virtual-environments-in-visual-studio-code-on-ubuntu/
Upvotes: 1
Reputation: 679
Assuming you are using the donjayamanne.python plugin for Visual Studio Code you can set this in the User or Workspace Settings file (settings.json):
"python.pythonPath": "~/home/python/bin/python"
You can access the settings file in Visual Studio Code using File -> Preferences -> Settings.
Upvotes: 2