[wip]
Python 3.8.3 VS Code Windows 10
I can't execute import numpy etc. with the recently re-installed Python & VS Code, and an error occurs when I try to pip install.
Path should pass when installing Python, but when I check it,
Set a new PATH with environment variables. (Time required about 10 minutes)
Confirmation code
version_check.py
import os
print("PYTHONPATH:", os.environ.get('PYTHONPATH'))
print("PATH:", os.environ.get('PATH'))
Output result
output
PYTHONPATH: NONE
PATH: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Users\owner\AppData\Local\Programs\Python;C:\Users\owner\AppData\Local\Microsoft\WindowsApps;C:\Users\owner\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\owner\AppData\Local\Programs\Python\Python38\Lib\site-packages;
PYTHONPATH: NONE ↑ This is the problem.
Go to "Edit environment variables" in the search box and select "Environment variables (N) ...". Click New (W) ... in the system environment variable (S). PYTHONPATH in variable name (N) Enter C: \ Users \ owner \ AppData \ Local \ Programs \ Python \ Python38 \ Lib \ site-packages in the variable value (V).
Change the variable values owner and Python38 to suit your environment.
When you run the code above, PYTHONPATH: C: \ Users \ owner \ AppData \ Local \ Programs \ Python \ Python38 \ Lib \ site-packages and pip can be executed.
Note that import numpy is still an error and cannot be imported. Described separately.
2020/11/11
Recommended Posts