invalid python interpreter selected for the project
reason : Not set django Project interpreter
solve : stay setting Just set it in the ( Optional local interpreter , You can also choose conda Environment )
Error: [WinError 10013] Made an attempt to access the socket in a way that the access permission is not allowed
reason : The port is occupied by other processes , Or the last operation did not shut down normally
solve :
Primary solution : Kill the process
netstat -ano|findstr 8000( View occupancy 8000 Port process id)
taskkill /pid process id /F ( Kill the process found in the previous step )
Ultimate solution : If this problem persists , Just replace django Default port
You have 18 unapplied migration(s). Your project may not work properly until you apply the migration
solve : Run the specified instruction according to the prompt in the terminal
CSRF cookie not set. Refer to solve :https://www.jianshu.com/p/671deb51a968
because pycharm and vscode Use different environments , So all outsourcing needs to be downloaded again , Reconfiguration pycharm The use of conda The environment is vscode The environment used in
The framework for running code requires that there must be cuda, but pycharm testing cuda Keep returning false Or import with error torch Failure
solve : Copy yourself base Configured in the environment cuda Version of torch To pycharm It can be solved in the specified environment .( Remember to delete the original before copying cpu Version of torch)( With torch The first ones are copied to the configured interpreter site-package Next ( Note that all , Otherwise, there will be all kinds of strange mistakes )
pycharm debug perhaps run A file : Right click directly in the file debug
Generally, it is similar to this kind of next(os.walk(path)) Error when traversing the directory ,stopexception, Generally because path error , modify path that will do
Some of the packages install And import Their names are different
stay pycharm You can't use shortcut directly in :install package... open setting Can be in project Next manual search (+), Looking for bags ,install
Mass substitution remember to use shortcut keys :ctrl+shift+r Replace and pay attention to some spaces and so on
error:django is not importable in this environment:
reason :django Not installed , Or the installed version does not match the virtual environment
solve : have access to pip Install or install in setting Installation in
venv( A virtual environment ) It can't be deleted , Otherwise, you need to recreate the project
invalid python sdk:
reason : No interpreter selected
solve : Same as the first problem
ModuleNotFoundError: No module named 'backports', Installed backports After that, it still reported an error
reason : Because this package has many branches , Specific downloads are required
solve : You need to see what is imported from this package , Then actually download backports.xxx
NameError: name '_C' is not defined : Restarting the compiler is useless
pycharm Use base Environmental Science , Can't be directly in pycharm Installation package in
solve : After downloading in other environments , Copied to the base Of site-package Next
Note that the name contains “info” My bag , If it does not have a corresponding paired package , Maybe it just corresponds to a module ( That is, a py file ), You need to copy both
stay pycharm You want to import modules from folders under the same level directory :
Right click on the folder ->mark as-> Set it to source
If it doesn't work , You can try adding one in front “.”
If it is not possible, you can go directly from package Start import