1.pip安装过程中报错,是因为是国外源
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ConnectTimeoutError(<pip._vend
or.urllib3.connection.HTTPSConnection object at 0x0000019A129144F0>, ‘Connection to files.pythonhosted.org timed out. (connect timeout=15)’)’: /packages/3b/7e/293d19ccd106119e35db4bf3e111b1895098f618b455b758aa636496cf03/setuptools-28.8.0-py2.py3-none-any.whl
这是因为python源在国外,所以会出现链接超时,永久设置pip源为国内源即可
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
2.设置国内源后仍然报错,是因为python3.10后不支持mysqlclient安装,将pip升级后再运行安装命令:
python -m pip install --upgrade pip
command: ‘C:\Users\EDY\AppData\Local\Programs\Python\Python310\python.exe’ -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’
C:\Users\EDY\AppData\Local\Temp\pip-install-vebf54om\mysqlclient_b5c2589bdb8f4e90a2ca7760e788af33\setup.py’“'”‘; file=’“'”‘C:\Users\ED
Y\AppData\Local\Temp\pip-install-vebf54om\mysqlclient_b5c2589bdb8f4e90a2ca7760e788af33\setup.py’“'”‘;f = getattr(tokenize, ‘"’“‘open’”’“‘, ope
n)(file) if os.path.exists(file) else io.StringIO(’”‘“‘from setuptools import setup; setup()’”’“‘);code = f.read().replace(’”‘"’\r\n’“'”‘, ’
"’“‘\n’”‘"’);f.close();exec(compile(code, file, ‘"’“‘exec’”‘"’))’ install --record ‘C:\Users\EDY\AppData\Local\Temp\pip-record-qogf1mro\install-
record.txt’ --single-version-externally-managed --compile --install-headers ‘C:\Users\EDY\AppData\Local\Programs\Python\Python310\Include\mysqlclient’
cwd: C:\Users\EDY\AppData\Local\Temp\pip-install-vebf54om\mysqlclient_b5c2589bdb8f4e90a2ca7760e788af33
Complete output (19 lines):
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\EDY\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools_init_.py”, line 10, in
from setuptools.extern.six.moves import filter, filterfalse, map
File “C:\Users\EDY\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\extern_init_.py”, line 1, in
from pkg_resources.extern import VendorImporter
File “C:\Users\EDY\AppData\Local\Programs\Python\Python310\lib\site-packages\pkg_resources_init_.py”, line 74, in
import(‘pkg_resources.extern.packaging.requirements’)
File “C:\Users\EDY\AppData\Local\Programs\Python\Python310\lib\site-packages\pkg_resources_vendor\packaging\requirements.py”, line 9, in
from pkg_resources.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
File “
ERROR: Command errored out with exit status 1: ‘C:\Users\EDY\AppData\Local\Programs\Python\Python310\python.exe’ -u -c ‘import io, os, sys, setuptoo
ls, tokenize; sys.argv[0] = ‘"’"‘C:\Users\EDY\AppData\Local\Temp\pip-install-vebf54om\mysqlclient_b5c2589bdb8f4e90a2ca7760e788af33\setup.py’
"’“‘; file=’”‘“‘C:\Users\EDY\AppData\Local\Temp\pip-install-vebf54om\mysqlclient_b5c2589bdb8f4e90a2ca7760e788af33\setup.py’”’“';f = geta
ttr(tokenize, '”‘“‘open’”’“‘, open)(file) if os.path.exists(file) else io.StringIO(’”‘“‘from setuptools import setup; setup()’”’“‘);code = f
.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ install --record ‘C:\Users\EDY\AppData\Local
Temp\pip-record-qogf1mro\install-record.txt’ --single-version-externally-managed --compile --install-headers ‘C:\Users\EDY\AppData\Local\Programs\Python\Python310\Include\mysqlclient’ Check the logs for full command output.
WARNING: You are using pip version 21.2.3; however, version 24.2 is available.
You should consider upgrading via the ‘C:\Users\EDY\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip’ command.
3.再次运行安装依赖命令仍然报错,仍然说是python3.10不支持mysqlclient
Getting requirements to build wheel … error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
Traceback (most recent call last):
File “C:\Users\EDY\AppData\Local\Programs\Python\Python310\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py”, line 353, in
main()
File “C:\Users\EDY\AppData\Local\Programs\Python\Python310\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py”, line 335, in main
json_out[‘return_val’] = hook(**hook_input[‘kwargs’])
File “C:\Users\EDY\AppData\Local\Programs\Python\Python310\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py”, line 118, in get_requires_for_build_wheel
return hook(config_settings)
File “C:\Users\EDY\AppData\Local\Temp\pip-build-env-latu1323\overlay\Lib\site-packages\setuptools\build_meta.py”, line 332, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
File “C:\Users\EDY\AppData\Local\Temp\pip-build-env-latu1323\overlay\Lib\site-packages\setuptools\build_meta.py”, line 302, in _get_build_requires
self.run_setup()
File “C:\Users\EDY\AppData\Local\Temp\pip-build-env-latu1323\overlay\Lib\site-packages\setuptools\build_meta.py”, line 503, in run_setup
super().run_setup(setup_script=setup_script)
File “C:\Users\EDY\AppData\Local\Temp\pip-build-env-latu1323\overlay\Lib\site-packages\setuptools\build_meta.py”, line 318, in run_setup
exec(code, locals())
File “”, line 11, in
File “C:\Users\EDY\AppData\Local\Temp\pip-install-th4vyefa\mysqlclient_f4677bdfdfdb4faaa461329a0597dceb\setup_windows.py”, line 2, in
from distutils.msvccompiler import get_build_version
ModuleNotFoundError: No module named ‘distutils.msvccompiler’
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
尝试安装pymysql仍然报错:
pip install pymysql
WARNING: Error parsing dependencies of celery: Expected matching RIGHT_PARENTHESIS for LEFT_PARENTHESIS, after version specifier
pytz (>dev)这个警告信息表明 Python 在解析 celery 库的依赖项时遇到了问题。具体的问题出在 pytz (>dev) 这个依赖项上。在 Python 的依赖项规范中,版本号后的括号 (>dev) 是不合法的。
5.尝试直接安装 pytz,然后再安装 celery