【Python 笔记】python 和 pip 常见问题解决方案

本文记录使用pip过程中常见问题的解决方案

Q&A 1.

1.问题详情:
Windows 下更新 pip 时报错:

>pip install pip
Traceback (most recent call last):
  File "d:\program files\python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:\program files\python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\Program Files\Python36\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'

2.解决方案:

>py -3 -m ensurepip    # call python3
>py -3 -m pip install --upgrade pip

Q&A 2.

1.问题详情:
安装了 pip3 install pillow==7.0.0,pillow 版本问题.

from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION
ImportError: cannot import name 'PILLOW_VERSION'

2.解决方案:
降低 pillow 版本

pip install 'pillow<7.0.0'

Q&A 3.

1.问题详情:
安装了 pip3 install numpy==1.18.1,numpy 版本问题.

>>>np.linspace(.5, 0.95, np.round((0.95 - .5) / .05) + 1, endpoint=True)
Traceback (most recent call last):
  ...
TypeError: 'numpy.float64' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  ...
  ...
TypeError: object of type <class 'numpy.float64'> cannot be safely interpreted as an integer.

2.解决方案:
降低 numpy 版本

pip install 'numpy<1.18.0'
发布了68 篇原创文章 · 获赞 27 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/RadiantJeral/article/details/104320749