D
D
Dimchik2021-08-24 08:28:32
pip
Dimchik, 2021-08-24 08:28:32

An error occurs when installing pip: Error: Exception: How to solve?

I'm trying to install pip via cmd. Throws an error:

ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\D1ma$PC\AppData\Local\Programs\Python\Python39\lib\distutils\util.py", line 205, in subst_vars
return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, s)
File "C:\Users\D1ma$PC\AppData\Local\Programs \Python\Python39\lib\re.py", line 210, in sub
return _compile(pattern, flags).sub(repl, string, count)
File "C:\Users\D1ma$PC\AppData\Local\Programs\ Python\Python39\lib\distutils\util.py", line 202, in _subst
return os.environ[var_name]
File "C:\Users\D1ma$PC\AppData\Local\Programs\Python\Python39\lib\os. py", line 679,
KeyError: 'PC'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\D1ma$PC\AppData\Local\Temp\tmp7s6zlno2\pip.zip\pip\_internal \cli\base_command.py", line 173, in _main
status = self.run(options, args)
File "C:\Users\D1ma$PC\AppData\Local\Temp\tmp7s6zlno2\pip.zip\pip\_internal\ cli\req_command.py", line 203, in wrapper
return func(self, options, args)
File "C:\Users\D1ma$PC\AppData\Local\Temp\tmp7s6zlno2\pip.zip\pip\_internal\commands\ install.py", line 239, in run
options.use_user_site = decide_user_install(
File "C:\Users\D1ma$PC\AppData\Local\Temp\tmp7s6zlno2\pip.zip\pip\_internal\commands\install.py",line 652, in decide_user_install
if site_packages_writable(root=root_path, isolated=isolated_mode):
File "C:\Users\D1ma$PC\AppData\Local\Temp\tmp7s6zlno2\pip.zip\pip\_internal\commands\install.py", line 598, in site_packages_writable
get_lib_location_guesses(root=root, isolated=isolated))
File "C:\Users\D1ma$PC\AppData\Local\Temp\tmp7s6zlno2\pip.zip\pip\_internal\commands\install.py", line 584, in get_lib_location_guesses
scheme = get_scheme(
File "C:\Users\D1ma$PC\AppData\Local\Temp\tmp7s6zlno2\pip.zip\pip\_internal\locations\__init__.py", line 159, in get_scheme
old = _distutils.get_scheme(
File "C:\Users\D1ma$PC\AppData\Local\Temp\tmp7s6zlno2\pip.zip\pip\_internal\locations\_distutils.py", line 130, in get_scheme
scheme = distutils_scheme(dist_name, user, home, root, isolated, prefix)
File "C:\Users\D1ma$PC\AppData\Local\Temp\tmp7s6zlno2\pip.zip\pip\_internal\locations\_distutils.py", line 69, in distutils_scheme
i.finalize_options()
File "C:\Users\D1ma$PC\AppData\Local\Programs\Python\Python39\lib\distutils\command\install.py", line 308, in finalize_options
self.expand_basedirs ()
File "C:\Users\D1ma$PC\AppData\Local\Programs\Python\Python39\lib\distutils\command\install.py", line 476, in expand_basedirs
self._expand_attrs(['install_base', 'install_platbase ', 'root'])
File "C:\Users\D1ma$PC\AppData\Local\Programs\Python\Python39\lib\distutils\command\install.py", line 470,in _expand_attrs
val = subst_vars(val, self.config_vars)
File "C:\Users\D1ma$PC\AppData\Local\Programs\Python\Python39\lib\distutils\util.py", line 207, in subst_vars
raise ValueError("invalid variable '$%s'" % var)
ValueError: invalid variable '$'PC''

Python version: 3.9

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-08-24
@Dimpik

Do not install Python in directories whose path contains characters other than Latin letters and numbers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question