关于python中pip安装库过程中报错的解决办法

发布时间 2023-11-27 22:17:54作者: KEEP12

晚上使用flask框架搭建web服务,启动后报错如下:

WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.

 经过搜索大法,发现是因为在开发环境中,Flask应用程序是使用内置的服务器(如SimpleServer或Lighttpd)运行的,而不是使用WSGI服务器。于是,尝试安装Gevent和pywsgi库。

pip install gevent pywsgi

 结果又报错(好好好)

ERROR: Could not find a version that satisfies the requirement pywsgi (from versions: none)
ERROR: No matching distribution found for pywsgi

 使用pip更新:

python -m pip install --upgrade pip

 更新后再用pip命令安装,又报错:

ERROR: Could not find a version that satisfies the requirement pywsgi (from versions: none)
ERROR: No matching distribution found for pywsgi

 看样子应该是网络问题,使用指定源进行安装,命令如下:

pip3 install [你要安装的包] -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

 最后,问题解决。