分享:解决pip更新报错File "C:\Python36-32\Scripts\pip36.exe\__main__.py", line 5, in ImportError:

需求, 新装python3.6.0。因为本地已存在python3.7.1,所以修改直接修改了python.exe ---> python36.exe

pip.exe --> pip36.exe

 

随后使用pip36 安装模块,提示版本pip 版本过低,随后使用 python36 -m pip install --upgrade pip  更新pip。

之后就是报这个错:

D:\final_aa\1819>pip36
Traceback (most recent call last):
  File "c:\python36-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python36-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python36-32\Scripts\pip36.exe\__main__.py", line 5, in
ImportError: cannot import name 'main'

解决办法:

cd 到 C:\Python36-32\Scripts\ 目录下:  发现有 pip.exe  pip3.exe  pip36.exe ,删除前两个文件,保留想要的pip36.exe

随后测试,成功。

C:\Python36-32\Scripts>pip36 -V
pip 19.1.1 from c:\python36-32\lib\site-packages\pip (python 3.6)

C:\Python36-32\Scripts>pip36

Usage:
  pip36 [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  config                      Manage local and global configuration.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to
                              WARNING, ERROR, and CRITICAL logging levels).
  --log                Path to a verbose appending log.
  --proxy             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --retries         Maximum number of retries each connection should attempt (default 5 times).
  --timeout             Set the socket timeout (default 15 seconds).
  --exists-action    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup,
                              (a)bort.
  --trusted-host   Mark this host as trusted, even though it does not have valid or any HTTPS.
  --cert               Path to alternate CA bundle.
  --client-cert        Path to SSL client certificate, a single file containing the private key and the
                              certificate in PEM format.
  --cache-dir

          Store the cache data in .
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine whether a new version of pip is available for
                              download. Implied with --no-index.
  --no-color                  Suppress colored output

 

你可能感兴趣的:(python)