Pycharm First Python Project
When PyCharm starts, it actually provides many shortcuts:
!(#)
We click the "New Script" button, and PyCharm will help us create a script.py file and automatically initialize the code and environment:
!(#)
We can try modifying the script file and run it to see the output:
!(#)
* * *
## Create Project Through Menu Bar
Launch PyCharm, click "New Project".
!(#)
Enter the project name , set the project path, select the Python interpreter, and click "Create" to create the project.
!(#)
Next, we set the project to , and then create a Python script file under this project.
Right-click on the project, select **"New -> Python File"** to create a new Python file.
!(#)
Enter a file name, for example `-test.py`, to create a new Python file:
!(#)
Enter the following code in the file:
## Instance
print("Hello !")
After entering the code, you can click the run button in the top right corner:
!(#)
You can also right-click on the code area and select **"Run '-test'"** to run the code.
!(#)
* * *
## Project Settings
After creating the project, you can click the settings icon in the top right corner to configure some settings:
!(#)
It includes some general editor configurations, and you can also configure the Python interpreter:
!(#)
* * *
## FAQ
### 1. What should I do if PyCharm prompts "No Python interpreter configured" on startup?
This means PyCharm has not detected a Python interpreter. You can manually add an interpreter:
1. Open "File -> Settings" (Windows/Linux) or "PyCharm -> Preferences" (macOS).
2. Select "Project: -> Python Interpreter" in the left menu.
3. Click "Add Interpreter" in the top right corner.
4. Select the path of the installed Python interpreter.
!(#)
### 2. How to install third-party libraries?
In PyCharm, you can install third-party libraries through the following steps:
1. Open "File -> Settings" (Windows/Linux) or "PyCharm -> Preferences" (macOS).
2. Select "Project: -> Python Interpreter" in the left menu.
3. Click the "+" button in the bottom right corner, search for and install the required library.
!(#)
YouTip