Reputation: 324
Using the Windows command line, how can I open a Python file inside the current virtual environment that I am in?
For example, say I'm in my virtual environment:
(env) C:\MyFolder>
and then I want to open my Python file:
(env) C:\MyFolder>mypythonfile.py
The .py file will open in IDLE but not inside the (env) environment
Upvotes: 1
Views: 3262
Reputation: 31
To achieve this via 3 steps:
Suppose that you are using windows system and have open a cmd window.
You could use this command "where python" to check if your virtual environment is activated. If success, it should point to your virtual environment path at the first line.
A IDLE window should be popped up. You can check if this is within the virtual environment by import a package only installed in the virtual environment but not in the local python.
Now you can just try to press 'F5', you will see this file would be run in the virtual idle.
Upvotes: 2