如何在PyCharm 2017.3中将pandas设为默认包?
Got it, let's sort out this frustrating problem where you have to reinstall pandas every time you spin up a new project in PyCharm 2017.3. Here are two straightforward methods to make pandas a default package for all future projects:
Method 1: Set a Preconfigured Default Interpreter
This works if you want all new projects to use the same Python environment (system-wide or a pre-made virtual env) that already has pandas installed.
- First, close any open projects to get back to PyCharm's welcome screen.
- Click Configure (bottom-right corner) → select Default Settings (this edits global settings, not just for one project).
- In the Default Settings window, navigate to Project Interpreter (under Project Settings).
- From the dropdown at the top, pick the interpreter you want to use as default (e.g., your system Python or a virtual env you've already set up). If pandas isn't installed here yet:
- Click the
+button on the right side of the interpreter list. - Search for "pandas" in the package list, select it, then click Install Package.
- Click the
- Once that's done, click Apply then OK. Now every new project you create will automatically use this interpreter with pandas pre-installed.
Method 2: Create a Project Template with Pandas
If you prefer using fresh virtual environments for each project but want pandas included by default, a project template is the way to go:
- Create a new temporary project first. Set up its interpreter (virtual env or whatever you prefer) and install pandas like you normally would.
- Once the project is set up and pandas works, go to File → Export to Template.
- Give your template a name (like "Pandas Base Project") and add a short description if you want. Follow the prompts to save it.
- Next time you create a new project, select Create from Template in the welcome screen, pick your saved template, and you'll get a new project with pandas already installed and ready to use.
A quick note: Make sure you're editing Default Settings (not the regular project-specific Settings) when setting the default interpreter—this is easy to mix up in 2017.3!
内容的提问来源于stack exchange,提问作者S. Whang

