[PYTHON] What to do if pip cannot be installed

[wip]

environment

Python 3.8.3 VS Code Windows 10

background

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.

problem

Path should pass when installing Python, but when I check it,

Conclusion

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

What to do if pip cannot be installed
What to do if PyAudio cannot be installed on Python 3.7, 3.8, 3.9 on Windows
What to do if the package dependency cannot be repaired
Note: What to do if pip install fails
What to do if mod_fcgid cannot resolve UnicodeEncodeError
What to do if pip install fails in Xcode 5.1
What to do if you can't pip install mysqlclient
What to do if a UnicodeDecodeError occurs in pip
What to do if pip install fails to install dependent libraries
What to do if yum breaks
What to do if pip gives a DistributionError in Homebrew
What to do if `pip install matplotlib` fails on Mac
What to do if pip install mysqlclient fails on MacOS
What to do if pvcreate produces a lot of WARNING and cannot be created
Notes on what to do if "macOS 11 or later required!" Appears in Big Sur or pyarrow2.0.0 cannot be installed
What to do if you can't install pyaudio with pip #Python
What to do when a video cannot be read by cv2.VideoCapture
What to do if you get a UnicodeDecodeError with pip install
What to do if ʻObject arrays cannot be loaded when allow_pickle = False` occurs in numpy.load ()
What to do if pipreqs results in UnicodeDecodeError
What to do if you can't pipenv shell
What to do if rails s doesn't work
What to do if you can't install with pip in babun environment
What to do if atom autocomplete-python doesn't work
What to do if you get Could not fetch URL 443 with pip
What to do if Docker-sync suddenly stops working
What to do if "amazon-linux-extras" → "No module named amazon_linux_extras"
What to do if you get the error Target WSGI script'/var/www/xxx/xxx.wsgi' cannot be loaded as python module
[Python] What to do if an error occurs in pip (pyinstaller, pyautogui, etc.)
What to do if scrapy doesn't work after installing scrapy with pip on mac
[Ubuntu 18.04 LTS] What to do when the screen resolution cannot be selected [NVIDIA]
What to do if Japanese language support is not completely installed on Ubuntu 16.04
No module named What to do if you get'libs.resources'
ModuleNotFoundError: No module What to do if you get'tensorflow.contrib'
Import libraries that cannot be pip installed with PyCharm
What to do when "cannot import name xxx" [Python]
What to do if sys / cdefs.h does not exist
What to do if pyenv is not enabled (zsh)
When pydub cannot be installed
[AWS] What to do when you want to pip with Lambda
What to do if ʻarguments [0] .scrollIntoView ();` fails in python selenium
What to do if you are addicted to Windows character code
Move what you installed with pip to the conda environment
What to do if you get "coverage unknown" in Coveralls
What to do if you can't sort files with subscripts
What to do if a 0xC0000005 error occurs in tf.train.start_queue_runners ()
If it is not easy to understand, it cannot be improved.
What to do if package installation fails when deploying to heroku
What to do if you can't log in as root
What to do if you can't use WiFi on Linux
What to do if Linux VLC can no longer rotate
What to do if you lose your EC2 key pair
[* CentOS 6.10] What to do if you cannot add the IUS Community Project repository on CentOS 6.5 (VirtualBox)
What to do if you get a Cannot retrieve metalink for repository error in yum
What to do if you get an Undefined error when trying to use pip with pyenv
What to do when Ubuntu crashes
What to do with Magics install
What to do to get tensorflow-gpu to work
What to do if Python doesn't work on Git for Windows
What to do if you get a minus zero in Python
What to do if intellisense doesn't work with Anaconda + VSCode + Tensorflow2.1