在Ubuntu 14.04中如何安装Python 3.6 IDLE以搭配Anaconda使用?
Hey there! I totally get your frustration—having Anaconda's smooth package management but missing the ability to save standard .py scripts like you do with IDLE is definitely a pain. Let's walk through a few straightforward solutions that'll get you up and running:
方案1:用Spyder(Anaconda自带的IDE)
This is probably the easiest fix. Anaconda comes with Spyder, a full-featured Python IDE built specifically for scientific computing, and it fully supports saving .py files just like IDLE. Here’s how to use it:
- Open Anaconda Navigator (search for it in your Ubuntu applications menu)
- Find the Spyder entry in the "Home" tab
- Click "Launch"—once it opens, write your code in the editor pane, save it as a .py file, and run it directly using the play button or F5 shortcut. Best of all, it automatically uses your Anaconda Python 3.6 environment, so all your packages will work seamlessly.
方案2:配置IDLE关联Anaconda的Python
If you really prefer using IDLE, you just need to make sure it’s using your Anaconda Python instead of the system’s default version. Here’s how:
- First, check if Anaconda has IDLE installed. Open a terminal and run:
This will install IDLE into your Anaconda environment if it’s not already there.conda install idle - Once installed, launch the Anaconda-specific IDLE directly from the terminal with:
(If you installed Anaconda in a different path, adjust the path accordingly—you can find your Anaconda location with~/anaconda3/bin/idle3which conda) - To make this easier, create a desktop shortcut: Right-click on your desktop, select "Create Launcher", fill in the name (like "Anaconda IDLE"), set the command to the path above, and pick an icon if you want. Now clicking this shortcut will open IDLE linked to your Anaconda Python 3.6, and any .py files you save will run with that environment.
方案3:文本编辑器 + 终端运行
If you prefer lightweight editors like Gedit, VS Code, or Sublime Text, save your code as .py files there and run them via the terminal with your Anaconda environment activated:
- Open a terminal and activate your Anaconda base environment (or any specific environment you use):
source ~/anaconda3/bin/activate - Navigate to the folder where you saved your .py file using
cd /path/to/your/file - Run the script with:
This ensures the script uses Anaconda’s Python 3.6 and has access to all your installed packages.python your_script.py
A quick tip: To confirm you’re using the right Python version, run which python in the terminal after activating the environment—it should show the path to your Anaconda Python installation.
内容的提问来源于stack exchange,提问作者a2warik

