Sublime Text 3安装插件报错:ImportError: No module named 'package_control'
Hey there, let's work through this frustrating Package Control issue you're hitting. That import error almost always means there's a corrupted or incomplete Package Control installation—even if you've reinstalled it already. Here's how to fix it step by step:
Step 1: Fully Clean Up Package Control Residues
First, we need to wipe out all existing traces of Package Control to avoid leftover corrupted files:
- Close Sublime Text 3 completely (make sure it's not running in the background).
- Open File Explorer and navigate to
C:\Users\Tobias\AppData\Roaming\Sublime Text 3\Installed Packages. Delete thePackage Control.sublime-packagefile here. - Next, go to
C:\Users\Tobias\AppData\Roaming\Sublime Text 3\Packages. If you see a folder namedPackage Control, delete it too.
Step 2: Reinstall Package Control Manually
The manual installation method is more reliable than using the automatic script sometimes, especially if previous installs left gunk:
- Launch Sublime Text 3, then press `Ctrl + `` (the backtick key, right above your Tab key) to open the console.
- Paste the official ST3 installation code into the console and hit Enter. Wait for the installation to finish (you'll see a confirmation message in the console).
- Restart Sublime Text 3 once done.
Step 3: Check Windows Firewall & Proxy Settings
Windows 8's firewall might be blocking Package Control from accessing the plugin repositories:
- Open Control Panel > Windows Firewall > Allow an app or feature through Windows Firewall.
- Find Sublime Text 3 in the list, make sure both "Private" and "Public" network access are checked. Click OK to save.
- If you use a proxy server, configure it in Sublime's settings:
- Go to
Preferences > Settingsto open the user settings file. - Add these lines (replace with your proxy details if needed):
"http_proxy": "http://your-proxy-host:port", "https_proxy": "http://your-proxy-host:port" - Save the settings and restart Sublime. If you don't use a proxy, make sure there are no proxy-related lines in your user settings.
- Go to
Step 4: Clear Sublime's Cache (If Needed)
If the error still pops up, corrupted cache files might be the culprit:
- Close Sublime Text 3.
- Navigate to
C:\Users\Tobias\AppData\Roaming\Sublime Text 3\Cacheand delete all files and folders inside this directory. - Restart Sublime and try installing a plugin again.
Why This Happens
Most of the time, this error occurs when Package Control's core files get corrupted during an install/update, or when leftover files from a previous install conflict with the new one. Fully cleaning up before reinstalling ensures you start with a fresh, working copy.
内容的提问来源于stack exchange,提问作者LBridge

