os.py”, line 725, in getitem raise KeyError(key) from None KeyError: ‘PATH’
scenario: when I was working on the project, I encountered a problem. Everything was running normally on the Linux server, but there was a problem when I was running in the remote finalshell (the code behind the process actually ran), but it seemed that there was a problem with the environment.
when I instantiated a class, I was a little puzzled by this problem. When I began to find out about os.environ [“path”], I knew that Python did not load the environment (here I used the virtual environment instead of the system default Python). So I went into the virtual environment to execute this:
import os print(os.environ["PATH"])
It is found that there is a value here, but the bug reported is none. Therefore, at the beginning of the code, I add the value printed out just now to the code, and then I can continue to execute Python code in the virtual environment of the server on the remote shell
import os os.environ["PATH"] = "This string copies the value printed from the above code"
So far, everything can run normally
- [Solved] Virtualenvwrapper.sh error: There was a problem running the initialization hooks.
- Pytorch failed to specify GPU resolution
- Python3: Str.format Keyerror Solution for incoming parameter error
- [Solved] redis.exceptions.ResponseError: unknown command `KEYS`
- PIP Fatal error in launcher: Unable to create process using
- Attributeerror encountered when using ceilometer and gnocchi to execute commands related to gnocchi metric list: _Environ instance has no attribute ‘
- Pytorch error: `module ‘torch‘ has no attribute ‘__version___‘`
- [Solved] Docker+uWSGI+Flask Error: ModuleNotFoundError: No module named ‘flask‘
- RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future rel
- How to Solve jupyter notebook service error
- [Solved] SyntaxError: Missing parentheses in call to ‘print‘. Did you mean print(e)?
- 500 (International server error) server error in Flash + heroku
- django Internal server error 500 Modify source code to view print errors
- ImportError: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.23‘ not found
- Error occurred when finalizing generatordataset iterator [How to Solve]
- Cuda Runtime error (38) : no CUDA-capable device is detected
- [Solved] OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
- result = e.symbols[symb] KeyError: b‘system‘ [How to Solve]
- How to Solve ModuleNotFoundError: No module named ‘_bz2‘
- [Solved] Adb Shell Monkey Warning: can‘t create log.txt， Read-only file system