import sys
import traceback
import getopt
import os
ERROR_WRONG_USAGE = 1
ERROR_NO_PIP = 2
ERROR_NO_SETUPTOOLS = 3
ERROR_EXCEPTION = 4
os.putenv("PIP_REQUIRE_VIRTUALENV", "false")
def exit(retcode):
major, minor, micro, release, serial = sys.version_info
version = major * 10 + minor
if version < 25:
import os
os._exit(retcode)
else:
sys.exit(retcode)
def usage():
sys.stderr.write('Usage: packaging_tool.py <list|install|uninstall|pyvenv>\n')
sys.stderr.flush()
exit(ERROR_WRONG_USAGE)
def error(message, retcode):
sys.stderr.write('Error: %s\n' % message)
sys.stderr.flush()
exit(retcode)
def error_no_pip():
type, value, tb = sys.exc_info()
if tb is not None and tb.tb_next is None:
error("Python packaging tool 'pip' not found", ERROR_NO_PIP)
else:
error(traceback.format_exc(), ERROR_EXCEPTION
packaging_tool解决pycharm因pip更新无法安装扩展包
最新推荐文章于 2024-07-21 03:44:27 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)