Пытаюсь установить pip через cmd. Вываливает ошибку:
ERROR: Exception:
Traceback (most recent call last):
File «C:UsersD1ma$PCAppDataLocalProgramsPythonPython39libdistutilsutil.py», line 205, in subst_vars
return re.sub(r’$([a-zA-Z_][a-zA-Z_0-9]*)’, _subst, s)
File «C:UsersD1ma$PCAppDataLocalProgramsPythonPython39libre.py», line 210, in sub
return _compile(pattern, flags).sub(repl, string, count)
File «C:UsersD1ma$PCAppDataLocalProgramsPythonPython39libdistutilsutil.py», line 202, in _subst
return os.environ[var_name]
File «C:UsersD1ma$PCAppDataLocalProgramsPythonPython39libos.py», line 679, in __getitem__
raise KeyError(key) from None
KeyError: ‘PC’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File «C:UsersD1ma$PCAppDataLocalTemptmp7s6zlno2pip.zippip_internalclibase_command.py», line 173, in _main
status = self.run(options, args)
File «C:UsersD1ma$PCAppDataLocalTemptmp7s6zlno2pip.zippip_internalclireq_command.py», line 203, in wrapper
return func(self, options, args)
File «C:UsersD1ma$PCAppDataLocalTemptmp7s6zlno2pip.zippip_internalcommandsinstall.py», line 239, in run
options.use_user_site = decide_user_install(
File «C:UsersD1ma$PCAppDataLocalTemptmp7s6zlno2pip.zippip_internalcommandsinstall.py», line 652, in decide_user_install
if site_packages_writable(root=root_path, isolated=isolated_mode):
File «C:UsersD1ma$PCAppDataLocalTemptmp7s6zlno2pip.zippip_internalcommandsinstall.py», line 598, in site_packages_writable
get_lib_location_guesses(root=root, isolated=isolated))
File «C:UsersD1ma$PCAppDataLocalTemptmp7s6zlno2pip.zippip_internalcommandsinstall.py», line 584, in get_lib_location_guesses
scheme = get_scheme(
File «C:UsersD1ma$PCAppDataLocalTemptmp7s6zlno2pip.zippip_internallocations__init__.py», line 159, in get_scheme
old = _distutils.get_scheme(
File «C:UsersD1ma$PCAppDataLocalTemptmp7s6zlno2pip.zippip_internallocations_distutils.py», line 130, in get_scheme
scheme = distutils_scheme(dist_name, user, home, root, isolated, prefix)
File «C:UsersD1ma$PCAppDataLocalTemptmp7s6zlno2pip.zippip_internallocations_distutils.py», line 69, in distutils_scheme
i.finalize_options()
File «C:UsersD1ma$PCAppDataLocalProgramsPythonPython39libdistutilscommandinstall.py», line 308, in finalize_options
self.expand_basedirs()
File «C:UsersD1ma$PCAppDataLocalProgramsPythonPython39libdistutilscommandinstall.py», line 476, in expand_basedirs
self._expand_attrs([‘install_base’, ‘install_platbase’, ‘root’])
File «C:UsersD1ma$PCAppDataLocalProgramsPythonPython39libdistutilscommandinstall.py», line 470, in _expand_attrs
val = subst_vars(val, self.config_vars)
File «C:UsersD1ma$PCAppDataLocalProgramsPythonPython39libdistutilsutil.py», line 207, in subst_vars
raise ValueError(«invalid variable ‘$%s'» % var)
ValueError: invalid variable ‘$’PC»
Версия python : 3.9
I have this issue with using and creating virtualenv module and also tried the solution below and now the pip doesn’t work too and when I type pip in the command prompt it returns me >> pip is not recognized as an internal or external command
Saw somewhere else on the web and tried following steps individually on the command prompt. It helped me move ahead. You can give it a try.
python -m pip uninstall pip
python -m ensurepip
python -m pip install -U pip
type 'virtualenv venv'
output
RuntimeError: failed to build image wheel, pip because:
Traceback (most recent call last):
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesvirtualenvseedembedvia_app_datavia_app_data.py", line 57, in _install
installer.install(creator.interpreter.version_info)
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesvirtualenvseedembedvia_app_datapip_installbase.py", line 47, in install
consoles.update(self._create_console_entry_point(name, module, script_dir, version_info))
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesvirtualenvseedembedvia_app_datapip_installbase.py", line 149, in _create_console_entry_point
new_files = maker.make(specification)
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesdistlibscripts.py", line 411, in make
self._make_script(entry, filenames, options=options)
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesdistlibscripts.py", line 312, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesvirtualenvseedembedvia_app_datapip_installbase.py", line 173, in _write_script
super(ScriptMakerCustom, self)._write_script(names, shebang, script_bytes, filenames, ext)
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesdistlibscripts.py", line 242, in _write_script
launcher = self._get_launcher('t')
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesdistlibscripts.py", line 390, in _get_launcher
raise ValueError(msg)
ValueError: Unable to find resource t64.exe in package distlib
Traceback (most recent call last):
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesvirtualenvseedembedvia_app_datavia_app_data.py", line 57, in _install
installer.install(creator.interpreter.version_info)
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesvirtualenvseedembedvia_app_datapip_installbase.py", line 47, in install
consoles.update(self._create_console_entry_point(name, module, script_dir, version_info))
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesvirtualenvseedembedvia_app_datapip_installbase.py", line 149, in _create_console_entry_point
new_files = maker.make(specification)
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesdistlibscripts.py", line 411, in make
self._make_script(entry, filenames, options=options)
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesdistlibscripts.py", line 312, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesvirtualenvseedembedvia_app_datapip_installbase.py", line 173, in _write_script
super(ScriptMakerCustom, self)._write_script(names, shebang, script_bytes, filenames, ext)
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesdistlibscripts.py", line 242, in _write_script
launcher = self._get_launcher('t')
File "c:usersmehranappdatalocalprogramspythonpython39libsite-packagesdistlibscripts.py", line 390, in _get_launcher
raise ValueError(msg)
ValueError: Unable to find resource t64.exe in package distlib
Изучаю pyyhon 3, для работы с буфером памяти в задании требуется установить piperclip, выполняю через командную строку.
Не получается, обновить pip до последней версии тоже не получается.
Microsoft Windows
© Корпорация Майкрософт (Microsoft Corporation), 2019. Все права защищены.
C:Usersя>pip install pyperclip
Collecting pyperclip
Downloading https://files.pythonhosted.org/packages/2d/0f/4eda562dffd085945d57c2d9a5da745cfb5228c02bc90f2c74bbac746243/pyperclip-1.7.0.tar.gz
Installing collected packages: pyperclip
Running setup.py install for pyperclip … error
Exception:
Traceback (most recent call last):
File “c:program filespython36libsite-packagespipcompat__init__.py”, line 73, in console_to_str
return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xce in position 81: invalid continuation byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “c:program filespython36libsite-packagespipbasecommand.py”, line 215, in main
status = self.run(options, args)
File “c:program filespython36libsite-packagespipcommandsinstall.py”, line 342, in run
prefix=options.prefix_path,
File “c:program filespython36libsite-packagespipreqreq_set.py”, line 784, in install
**kwargs
File “c:program filespython36libsite-packagespipreqreq_install.py”, line 878, in install
spinner=spinner,
File “c:program filespython36libsite-packagespiputils__init__.py”, line 676, in call_subprocess
line = console_to_str(proc.stdout.readline())
File “c:program filespython36libsite-packagespipcompat__init__.py”, line 75, in console_to_str
return s.decode(‘utf_8’)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xce in position 81: invalid continuation byte
You are using pip version 9.0.1, however version 19.3.1 is available.
You should consider upgrading via the ‘python -m pip install –upgrade pip’ command.
C:Usersя>python -m pip install –upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 530kB/s
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Exception:
Traceback (most recent call last):
File “C:Program FilesPython36libshutil.py”, line 538, in move
os.rename(src, real_dst)
PermissionError: Отказано в доступе: ‘c:\program files\python36\lib\site-packages\pip-9.0.1.dist-info\description.rst’ -> ‘C:\Users\E0F1~1\AppData\Local\Temp\pip-26uz5vv9-uninstall\program files\python36\lib\site-packages\pip-9.0.1.dist-info\description.rst’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:Program FilesPython36libsite-packagespipbasecommand.py”, line 215, in main
status = self.run(options, args)
File “C:Program FilesPython36libsite-packagespipcommandsinstall.py”, line 342, in run
prefix=options.prefix_path,
File “C:Program FilesPython36libsite-packagespipreqreq_set.py”, line 778, in install
requirement.uninstall(auto_confirm=True)
File “C:Program FilesPython36libsite-packagespipreqreq_install.py”, line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File “C:Program FilesPython36libsite-packagespipreqreq_uninstall.py”, line 115, in remove
renames(path, new_path)
File “C:Program FilesPython36libsite-packagespiputils__init__.py”, line 267, in renames
shutil.move(old, new)
File “C:Program FilesPython36libshutil.py”, line 553, in move
os.unlink(src)
PermissionError: Отказано в доступе: ‘c:\program files\python36\lib\site-packages\pip-9.0.1.dist-info\description.rst’
You are using pip version 9.0.1, however version 19.3.1 is available.
You should consider upgrading via the ‘python -m pip install –upgrade pip’ command.
Догадался что дело в переменной окружения, прописал в Path путь до python.exe
Теперь сообщение
Microsoft Windows
© Корпорация Майкрософт (Microsoft Corporation), 2019. Все права защищены.
C:Usersя>python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> pip install piperclip
File “<stdin>”, line 1
pip install piperclip
^
SyntaxError: invalid syntax
>>>
Отредактировано Stanislav77 (Янв. 13, 2020 00:40:34)
anyone else having issue with pip today? I’ve tried to install tornado today and keep getting this garbage.
Code: Select all
pi@pi-4-1:~ $ sudo pip3 install tornado
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting tornado
Downloading https://www.piwheels.org/simple/tornado/tornado-6.1-cp39-cp39-linux_armv7l.whl (421 kB)
|██▎ | 30 kB 8.2 kB/s eta 0:00:48ERROR: Exception:
Traceback (most recent call last):
File "/usr/share/python-wheels/resolvelib-0.5.4-py2.py3-none-any.whl/resolvelib/resolvers.py", line 171, in _merge_into_criterion
crit = self.state.criteria[name]
KeyError: 'tornado'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/share/python-wheels/urllib3-1.26.5-py2.py3-none-any.whl/urllib3/response.py", line 438, in _error_catcher
yield
File "/usr/share/python-wheels/urllib3-1.26.5-py2.py3-none-any.whl/urllib3/response.py", line 519, in read
data = self._fp.read(amt) if not fp_closed else b""
File "/usr/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl/cachecontrol/filewrapper.py", line 62, in read
data = self.__fp.read(amt)
File "/usr/lib/python3.9/http/client.py", line 458, in read
n = self.readinto(b)
File "/usr/lib/python3.9/http/client.py", line 502, in readinto
n = self.fp.readinto(b)
File "/usr/lib/python3.9/socket.py", line 704, in readinto
return self._sock.recv_into(b)
File "/usr/lib/python3.9/ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "/usr/lib/python3.9/ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 223, in _main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
return func(self, options, args)
File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 346, in run
requirement_set = resolver.resolve(
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 122, in resolve
self._result = resolver.resolve(
File "/usr/share/python-wheels/resolvelib-0.5.4-py2.py3-none-any.whl/resolvelib/resolvers.py", line 453, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/usr/share/python-wheels/resolvelib-0.5.4-py2.py3-none-any.whl/resolvelib/resolvers.py", line 318, in resolve
name, crit = self._merge_into_criterion(r, parent=None)
File "/usr/share/python-wheels/resolvelib-0.5.4-py2.py3-none-any.whl/resolvelib/resolvers.py", line 173, in _merge_into_criterion
crit = Criterion.from_requirement(self._p, requirement, parent)
File "/usr/share/python-wheels/resolvelib-0.5.4-py2.py3-none-any.whl/resolvelib/resolvers.py", line 82, in from_requirement
if not cands:
File "/usr/share/python-wheels/resolvelib-0.5.4-py2.py3-none-any.whl/resolvelib/structs.py", line 124, in __bool__
return bool(self._sequence)
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 99, in __bool__
return any(self)
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/factory.py", line 239, in iter_index_candidates
candidate = self._make_candidate_from_link(
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/factory.py", line 167, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 296, in __init__
super(LinkCandidate, self).__init__(
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 144, in __init__
self.dist = self._prepare()
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 222, in _prepare
dist = self._prepare_distribution()
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 307, in _prepare_distribution
return self._factory.preparer.prepare_linked_requirement(
File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 480, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 503, in _prepare_linked_requirement
local_file = unpack_url(
File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 253, in unpack_url
file = get_http_url(
File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 130, in get_http_url
from_path, content_type = download(link, temp_dir.path)
File "/usr/lib/python3/dist-packages/pip/_internal/network/download.py", line 163, in __call__
for chunk in chunks:
File "/usr/lib/python3/dist-packages/pip/_internal/cli/progress_bars.py", line 168, in iter
for x in it:
File "/usr/lib/python3/dist-packages/pip/_internal/network/utils.py", line 64, in response_chunks
for chunk in response.raw.stream(
File "/usr/share/python-wheels/urllib3-1.26.5-py2.py3-none-any.whl/urllib3/response.py", line 576, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/usr/share/python-wheels/urllib3-1.26.5-py2.py3-none-any.whl/urllib3/response.py", line 541, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/usr/lib/python3.9/contextlib.py", line 135, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/share/python-wheels/urllib3-1.26.5-py2.py3-none-any.whl/urllib3/response.py", line 443, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='www.piwheels.org', port=443): Read timed out.