Reputation: 53
I have created a virtual environment for a python3 project.
phil@shuttle:$ python3 -m venv venv
phil@shuttle:$ source venv/bin/activate
(venv) phil@shuttle:$ python -V
Python 3.5.3
(venv) phil@shuttle:$
However, when I am in it, idle still defaults to python 2.7. The idle3 command work fine.
Can I change the default version of idle within the virtual environment (and not outside of it) so that don't keep using the wrong version?
(Supplementary question: do I have to do similar for pip/pip3?)
[Running Ubuntu 17.04]
Upvotes: 1
Views: 736
Reputation: 19174
IDLE is run by python, not the reverse. If you run
(venv) phil@shuttle:$ python -m idlelib
where python is 3.5.3, then that python will start the IDLE that comes with 3.5.3.
I do not have idle
or idle3
commands on Windows, so I cannot answer questions about it.
To run pip inside the venv, replace idlelib
with pip
and add pip arguments. If pip is not installed inside the venv, first run python -m ensurepip
and then run pip to upgrade pip.
Upvotes: 3