简体   繁体   English

Pip 不让我安装任何东西

[英]Pip won't let me install anything

Just setting up my python environments here.只需在此处设置我的 python 环境。 An absolute newb if you must say.如果您必须说,绝对是新手。

Background information: Currently at a place that requires a proxy to be set.背景信息:目前在需要设置代理的地方。 I do this by using the Manual Proxy Settings in Wondows Settings.我通过使用 Wondows 设置中的手动代理设置来做到这一点。

I did go ahead and add http_proxy, https_proxy, and socks_proxy to my system variables as follows HTTP_PROXY http://10.8.0.1:8080 HTTPS_PROXY https://10.8.0.1:8080 ALL_PROXY socks5://10.8.0.1:8080 I did go ahead and add http_proxy, https_proxy, and socks_proxy to my system variables as follows HTTP_PROXY http://10.8.0.1:8080 HTTPS_PROXY https://10.8.0.1:8080 ALL_PROXY socks5://10.8.0.1:8080

Any and everytime I type in to install any package through pip, I write the command "pip install package_name" on my powershell terminal, I get the error,每次我输入安装任何 package 到 pip 时,我都会在 powershell 终端上写命令“pip install package_name”,我得到错误

 Defaulting to user installation because normal site-packages is not writeable
ERROR: Exception:
Traceback (most recent call last):
  File "c:\program files\python38\lib\site-packages\pip\_internal\cli\base_command.py", line 180, in _main 
    status = self.run(options, args)
  File "c:\program files\python38\lib\site-packages\pip\_internal\cli\req_command.py", line 204, in wrapper
    return func(self, options, args)
  File "c:\program files\python38\lib\site-packages\pip\_internal\commands\install.py", line 318, in run
    requirement_set = resolver.resolve(
  File "c:\program files\python38\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 127, in resolve
    result = self._result = resolver.resolve(
  File "c:\program files\python38\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 473, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "c:\program files\python38\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 341, in resolve
    name, crit = self._merge_into_criterion(r, parent=None)
  File "c:\program files\python38\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 172, in _merge_into_criterion
    if not criterion.candidates:
  File "c:\program files\python38\lib\site-packages\pip\_vendor\resolvelib\structs.py", line 139, in __bool__
    return bool(self._sequence)
  File "c:\program files\python38\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 143, in __bool__
    return any(self)
  File "c:\program files\python38\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 129, in <genexpr>
    return (c for c in iterator if id(c) not in self._incompatible_ids)
  File "c:\program files\python38\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 30, in _iter_built
    for version, func in infos:
  File "c:\program files\python38\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 258, in iter_index_candidate_infos
    result = self._finder.find_best_candidate(
  File "c:\program files\python38\lib\site-packages\pip\_internal\index\package_finder.py", line 879, in find_best_candidate
    candidates = self.find_all_candidates(project_name)
  File "c:\program files\python38\lib\site-packages\pip\_internal\index\package_finder.py", line 824, in find_all_candidates
    page_candidates = list(page_candidates_it)
  File "c:\program files\python38\lib\site-packages\pip\_internal\index\sources.py", line 134, in page_candidates
    yield from self._candidates_from_page(self._link)
  File "c:\program files\python38\lib\site-packages\pip\_internal\index\package_finder.py", line 783, in process_project_url
    html_page = self._link_collector.fetch_page(project_url)
  File "c:\program files\python38\lib\site-packages\pip\_internal\index\collector.py", line 512, in fetch_page
    return _get_html_page(location, session=self.session)
  File "c:\program files\python38\lib\site-packages\pip\_internal\index\collector.py", line 422, in _get_html_page
    resp = _get_html_response(url, session=session)
  File "c:\program files\python38\lib\site-packages\pip\_internal\index\collector.py", line 120, in _get_html_response
    resp = session.get(
  File "c:\program files\python38\lib\site-packages\pip\_vendor\requests\sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "c:\program files\python38\lib\site-packages\pip\_internal\network\session.py", line 449, in request
    return super().request(method, url, *args, **kwargs)
  File "c:\program files\python38\lib\site-packages\pip\_vendor\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\program files\python38\lib\site-packages\pip\_vendor\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "c:\program files\python38\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 53, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "c:\program files\python38\lib\site-packages\pip\_vendor\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "c:\program files\python38\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 696, in urlopen
    self._prepare_proxy(conn)
  File "c:\program files\python38\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 964, in _prepare_proxy
    conn.connect()
  File "c:\program files\python38\lib\site-packages\pip\_vendor\urllib3\connection.py", line 359, in connect
    conn = self._connect_tls_proxy(hostname, conn)
  File "c:\program files\python38\lib\site-packages\pip\_vendor\urllib3\connection.py", line 500, in _connect_tls_proxy
    return ssl_wrap_socket(
  File "c:\program files\python38\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py", line 432, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
  File "c:\program files\python38\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py", line 474, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
  File "c:\program files\python38\lib\ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "c:\program files\python38\lib\ssl.py", line 997, in _create
    raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname

What am I supposed to do?我应该做些什么? Another answer on stackoverflow which I am assuming is for the same problem is to downgrade urlib3 using "pip install urllib3==1.25.11" but I literally can't use pip because all I'd get is the same error.我假设的关于stackoverflow的另一个答案是针对相同的问题是使用“pip install urllib3 == 1.25.11”降级urlib3,但我实际上不能使用pip,因为我得到的都是相同的错误。

I have since also tried to install and reinstall python.从那以后,我还尝试安装和重新安装 python。 Even went from 3.9.5 to 3.8.10 but the problem still persists.甚至从 3.9.5 到 3.8.10 但问题仍然存在。

Please help请帮忙

I also found the answer that suggested to downgrade urllib3==1.25.11.我还找到了建议降级 urllib3==1.25.11 的答案。 As I understand, You can try to install urllib3 from local.据我了解,您可以尝试从本地安装 urllib3。

pip install <path-to-package>

here to download package 在这里下载package

(To make my comment an answer:) (让我的评论成为答案:)

The HTTPS proxy should probably not be using the https:// protocol itself, so HTTPS 代理可能不应该使用 https:// 协议本身,所以

HTTP_PROXY=http://10.8.0.1:8080
HTTPS_PROXY=http://10.8.0.1:8080

should be the more correct environment variables.应该是更正确的环境变量。

Have you created a local environment using something like您是否使用类似的东西创建了本地环境

python.exe -m venv env python.exe -m venv env

? ? It seems like you are trying to install packages on the main python install您似乎正在尝试在主 python 安装上安装软件包

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM