尝试安装 pip 时,ValueError:以 10 为基数的 int() 的文字无效

尝试安装 pip 时,ValueError:以 10 为基数的 int() 的文字无效

一两天来,我使用 pip 时都遇到这个错误。最初,我以为是它pip本身的问题,因为每当我尝试安装包时,它都会出错并失败。因此,我卸载了pip它,打算重新安装并重试。现在,当我尝试使用 重新安装时,我看到了错误python get-pip.py。(此外,我以前从未使用过 JFrog 或 Artifactory,所以我不知道这是否是问题所在。)

编辑:下面,我附上了原始错误消息,其中包括 Python 2.7 弃用警告。运行时python3 get-pip.py出现同样的问题,但没有弃用警告。

MBP-19-C02ZF9ZDLVDL:~ gabriellabova$ python get-pip.py
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Looking in indexes: https://****@indigoag.com:AKCp5e2gKoGrMKv41KDCjoFdKZLSpkZpHNkfydx3U67PdgUEJwXVVeRpTpU1zoSnuT1wovUWX%40indigoag.jfrog.io/indigoag/api/pypi/pypi/simple
ERROR: Exception:
Traceback (most recent call last):
  File "/var/folders/ff/g7nk9zzj1cl_b48qw4vsy_w40000gp/T/tmpSOLhyE/pip.zip/pip/_internal/cli/base_command.py", line 153, in _main
    status = self.run(options, args)
  File "/var/folders/ff/g7nk9zzj1cl_b48qw4vsy_w40000gp/T/tmpSOLhyE/pip.zip/pip/_internal/commands/install.py", line 382, in run
    resolver.resolve(requirement_set)
  File "/var/folders/ff/g7nk9zzj1cl_b48qw4vsy_w40000gp/T/tmpSOLhyE/pip.zip/pip/_internal/legacy_resolve.py", line 201, in resolve
    self._resolve_one(requirement_set, req)
  File "/var/folders/ff/g7nk9zzj1cl_b48qw4vsy_w40000gp/T/tmpSOLhyE/pip.zip/pip/_internal/legacy_resolve.py", line 365, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/var/folders/ff/g7nk9zzj1cl_b48qw4vsy_w40000gp/T/tmpSOLhyE/pip.zip/pip/_internal/legacy_resolve.py", line 311, in _get_abstract_dist_for
    req.populate_link(self.finder, upgrade_allowed, self.require_hashes)
  File "/var/folders/ff/g7nk9zzj1cl_b48qw4vsy_w40000gp/T/tmpSOLhyE/pip.zip/pip/_internal/req/req_install.py", line 225, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/var/folders/ff/g7nk9zzj1cl_b48qw4vsy_w40000gp/T/tmpSOLhyE/pip.zip/pip/_internal/index.py", line 879, in find_requirement
    req.name, specifier=req.specifier, hashes=hashes,
  File "/var/folders/ff/g7nk9zzj1cl_b48qw4vsy_w40000gp/T/tmpSOLhyE/pip.zip/pip/_internal/index.py", line 861, in find_best_candidate
    candidates = self.find_all_candidates(project_name)
  File "/var/folders/ff/g7nk9zzj1cl_b48qw4vsy_w40000gp/T/tmpSOLhyE/pip.zip/pip/_internal/index.py", line 791, in find_all_candidates
    collected_links = self._link_collector.collect_links(project_name)
  File "/var/folders/ff/g7nk9zzj1cl_b48qw4vsy_w40000gp/T/tmpSOLhyE/pip.zip/pip/_internal/collector.py", line 527, in collect_links
    if self.session.is_secure_origin(link)
  File "/var/folders/ff/g7nk9zzj1cl_b48qw4vsy_w40000gp/T/tmpSOLhyE/pip.zip/pip/_internal/network/session.py", line 345, in is_secure_origin
    parsed.scheme, parsed.hostname, parsed.port,
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urlparse.py", line 113, in port
    port = int(port, 10)
ValueError: invalid literal for int() with base 10: 'AKCp5e2gKoGrMKv41KDCjoFdKZLSpkZpHNkfydx3U67PdgUEJwXVVeRpTpU1zoSnuT1wovUWX%40indigoag.jfrog.io'

答案1

事实证明这是我的 Artifactory/JFrog 设置的问题。在我生成新的 Artifactory API 密钥并重新配置我的本地配置后,一切又开始正常工作了。

相关内容