If I open one file such as "hw3_prob4Sol.py", the code can run. However, there is an error: Cannot start process, the path specified for working directory is not a directory. I can use the following method to solve this problem.
PyCharm change working directory of console
Settings -> Build Execution Deployment -> Console -> Python Console

However, if I change the working directory every time, this gives me much trouble. Zhengxia is inspired by
I finally solved the problem.

I think it all started because the first project that I opened with pycharm was in my "download" folder, so the working directory was automatically set to a temporal folder by default and although I moved the project to another folder and I manually changed the working directory from the terminal, it was not working.

The solution was creating a new project and giving a correct path to the new project. It seems very easy but it was not that obvious." from https://stackoverflow.com/questions/28202273/working-directory-error/28975990.

He gave me the suggestion: File -> open, open the directory rather than open the file. For example, "
GAN\code\generative-models-master", he said that it is better to make the environment of the pycharm projects consistent (pycharm工程默认加载一个环境变量,最好同一个工程下环境一致). Then a file ".idea" will be created. In this way, all files of this folder will be seen as a part of this project. In the file ".idea", there will be the historical record, the path setting such as the interpreter. Generally, we do not use this file.