

Python初心者です。  
cmdよりpipインストールを実行するとエラーになり対処法がわからないためご教示頂けると幸いです。

_環境_  
Windows 10  
Python 3.7.3  
pip 19.0.3

_エラー （pip install reportlabを実行）_

[code]

    Collecting reportlab
    Exception:
    Traceback (most recent call last):
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\cli\base_command.py", line 179, in main
        status = self.run(options, args)
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\commands\install.py", line 315, in run
        resolver.resolve(requirement_set)
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\resolve.py", line 131, in resolve
        self._resolve_one(requirement_set, req)
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\resolve.py", line 294, in _resolve_one
        abstract_dist = self._get_abstract_dist_for(req_to_install)
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\resolve.py", line 242, in _get_abstract_dist_for
        self.require_hashes
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\operations\prepare.py", line 269, in prepare_linked_requirement
        req.populate_link(finder, upgrade_allowed, require_hashes)
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\req\req_install.py", line 196, in populate_link
        self.link = finder.find_requirement(self, upgrade)
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\index.py", line 639, in find_requirement
        all_candidates = self.find_all_candidates(req.name)
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\index.py", line 610, in find_all_candidates
        for page in self._get_pages(url_locations, project_name):
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\index.py", line 743, in _get_pages
        page = _get_html_page(location, session=self.session)
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\index.py", line 229, in _get_html_page
        resp = _get_html_response(url, session=session)
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\index.py", line 177, in _get_html_response
        "Cache-Control": "max-age=0",
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\requests\sessions.py", line 546, in get
        return self.request('GET', url, **kwargs)
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\download.py", line 403, in request
        return super(PipSession, self).request(method, url, *args, **kwargs)
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\requests\sessions.py", line 524, in request
        prep.url, proxies, stream, verify, cert
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\requests\sessions.py", line 700, in merge_environment_settings
        env_proxies = get_environ_proxies(url, no_proxy=no_proxy)
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\requests\utils.py", line 761, in get_environ_proxies
        if should_bypass_proxies(url, no_proxy=no_proxy):
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\requests\utils.py", line 745, in should_bypass_proxies
        bypass = proxy_bypass(parsed.hostname)
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\requests\utils.py", line 95, in proxy_bypass
        return proxy_bypass_registry(host)
      File "c:\users\yamada\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\requests\utils.py", line 61, in proxy_bypass_registry
        'ProxyEnable')[0])
    ValueError: invalid literal for int() with base 10: b'\x00\x00\x00\x00'
    
[/code]


CC BY-SA 4.0
2019-07-19T21:50:29.797
56759
2021-10-28T10:03:20.250
2019-07-20T07:24:31.117
3060
35176
question
python python3 pip
pip Install の実行時にエラーになってしまう


[本家SOの類似質問](https://stackoverflow.com/q/60111154)、[コメントの類似質問](https://stackoverflow.com/q/54577876)のいずれもレジストリを書き換えて解決していました。  
レジストリエディタから、`HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\ProxyEnable`の型を`REG_DWORD`に変更します。(`REG_BINARY`型になっている可能性があります)

これは推測ですが、Windows 64bit版にPython **32bit版**
をインストールするとpipがネットワーク接続する時にproxyの判定でレジストリを読みに行き、エラーが発生するようです。  
なので明示的にproxyを指定するとレジストリを使った判定ロジックを呼び出さずに正常動作すると予想しています。

なお本家SOではPython 32bit版をアンインストールして64bit版を入れなおしても、問題は解決しなかったと記載されています。  
その後にレジストリを書き換えて解決していました。


CC BY-SA 4.0
2020-08-05T01:57:12.653
69260
2020-08-05T01:57:12.653
9820
56759
answer