我正在尝试在我的代码中强制安装软件包。为此,我有这个:
import sys
import subprocess
subprocess.check_call([sys.executable, "-m", "pip", "install", 'JPype1==0.6.1 --force-reinstal'])
subprocess.check_call([sys.executable, "-m", "pip", "install", 'mysqlclient pymysql'])
但是,出现以下错误:
ERROR: Invalid requirement: 'JPype1==0.6.3 --force-reinstal'
subprocess.CalledProcessError: Command '[python.exe', '-m', 'pip', 'install', 'JPype1==0.6.3 --force-reinstal']' returned non-zero exit status 1.
任何人都有解决方案吗?谢谢!
import sys
import subprocess
subprocess.check_call([sys.executable, "-m", "pip", "install", 'JPype1==0.6.1', '--force-reinstall'])
subprocess.check_call([sys.executable, "-m", "pip", "install", 'mysqlclient', 'pymysql'])