Yashu Seth
Yashu Seth

Reputation: 985

How can I run IDLE for Python 3 in a Conda environment?

For running Python 2, all I do is activate the required Conda environment and just type idle. It automatically opens IDLE for Python 2.7.

But I can't figure out how to do this for Python 3. I have Python 3.5 installed in my environment. I used conda create -n py35 anaconda for installing Python 3.5.

Upvotes: 7

Views: 19877

Answers (5)

Vasantha Kumar
Vasantha Kumar

Reputation: 1

In Python, the idle editor, there is a target in properties in the idle shortcut

That is:

C:\Users\user1\AppData\Local\Programs\Python\python312\pythonw.exe 

"C:\Users\user1\AppData\Local\Programs\Python\python312\Lib\idlelib\idle.pyw"

Can we replace it by?

C:\Users\user1\anaconda\conda.exe
"C:\Users\user1\anaconda\Lib\idlelib\idle.pyw"

Upvotes: -1

nikpod
nikpod

Reputation: 1278

To install another version of Python (e.g., Python 3.5.2), when using Anaconda for one version of Python (e.g., Python 2.7), you can do the following on the Anaconda prompt:

First, create a new Conda environment and install Python 3.5.2 with anaconda:

conda create -n py352 python=3.5.2 anaconda

Once complete, if you want to access IDLE of Python 3.5.2 quickly on Windows:

  • Go to the "C:\..Anaconda\envs\py352" folder in Explorer

  • Create a shortcut for pythonw.exe file located on that folder.

  • Move the shortcut to your Desktop or any other location easily accessible

  • Right-click the shortcut, go to Properties, and change the target field in the Shortcut tab from

    C:\....\Anaconda\envs\py352\pythonw.exe
    

    to

    C:\...\Anaconda\envs\py352\pythonw.exe "C:\...\Anaconda\envs\py352\Lib\idlelib\idle.pyw"
    

Upvotes: 5

Leland Hepworth
Leland Hepworth

Reputation: 996

The other answer for creating a shortcut did not work for me, but I was able to get this to work:

  • Create your Conda environment if you haven't already. I'll call mine my_env.
  • Navigate to the C:\...\Anaconda\envs\my_env\Lib\idlelib\ directory
  • Create a shortcut for idle.bat
  • Move the shortcut to another location, rename it, and pin it as desired.

Upvotes: 0

la_leche
la_leche

Reputation: 473

For how to open IDLE from a Conda virtualenv, the process that works for me is:

activate myenv
python -m idlelib

This should open up the IDLE editor and you can run code within myenv.

Upvotes: 12

Type idle3 instead of idle from your Conda environment.

Upvotes: 6

Related Questions