[Pycharm] 使用记录

发布于 2023-06-29  112 次阅读


本地包安装注意事项

当PyCharm的项目文件夹下有与导入的包的名称完全一样的子文件夹时,会导致导入的代码内容时项目子文件夹中的代码,而非已经安装的包,因此要避免这种情况发生。

一句话: 不在项目文件夹下存储与任何导入的包的名称一致的文件夹!!!

直接将导入的包的名称在console中执行就可以看到包的路径,通过这种方式可以判断执行的到底是哪一个。

Add an external tool

You can add and run remote tools only in PyCharm Professional.

Step 1. Press Ctrl + Alt + S to open the IDE settings and select Tools | External Tools.

Step 2. Click the + button to add a new external tool.

Step 3. Add configuration options as shown below (%timeit for example):

Program:Program: The path to the pylint executable ($PyInterpreterDirectory$ is a directory where the Python interpreter of the current project is placed). A specific interpreter can also be specified.

Arguments:Specifies what files and folders should be checked (car.py and test in this example) and sets the output format for pylint errors. In this case it is -m timeit -t -n1 -r1 "import FileNameWithoutExtension".

Pycharm配置timeit(External Tools)测试执行时间 - 简书

Working directory should be where the file to be tested located.

Run the external tools

External tools PyCharm Documentation

届ける言葉を今は育ててる
最后更新于 2023-08-24