1.使用git命令创建仓库
git config --global user.name 'github名称'
git config --global user.email "git账号"
1.`# 在当前目录初始化一个新的Git仓库
git init
#克隆远程仓库到本地
git clone https://github.com/testdevhome/Autotestplat
2.安装依赖
pip install -r requirements.txt
3.创建并导入数据库
mysql -u root -p -e “CREATE DATABASE autotestplat;”
mysql -u root -p autotestplat < autotestplat.sql
配置数据库连接 编辑 settings.py 文件,配置数据库连接信息。
安装时候报错:
pip install -r requirements.txt
Collecting setuptools==28.8.0 (from -r requirements.txt (line 1))
Using cached setuptools-28.8.0-py2.py3-none-any.whl.metadata (11 kB)
Collecting kombu==3.0.37 (from -r requirements.txt (line 2))
Using cached kombu-3.0.37-py2.py3-none-any.whl.metadata (12 kB)
Collecting celery==3.1.26.post2 (from -r requirements.txt (line 3))
Using cached celery-3.1.26.post2-py2.py3-none-any.whl.metadata (14 kB)
WARNING: Ignoring version 3.1.26.post2 of celery since it has invalid metadata:
Requested celery==3.1.26.post2 from https://files.pythonhosted.org/packages/b1/27/cd2e097208f60a0512b8b3201f8bd93c1db359c3fa35cab2f405aa1d45a7/celery-3.1.26.post2-py2.py3-none-any.whl (from -r requirements.txt (line 3)) has invalid metadata: Expected matching RIGHT_PARENTHESIS for LEFT_PARENTHESIS, after version specifier
pytz (>dev)
~^
Please use pip<24.1 if you need to use this version.
ERROR: Ignored the following yanked versions: 5.0.6, 5.2.5
ERROR: Could not find a version that satisfies the requirement celery==3.1.26.post2 (from versions: 0.1.2, 0.1.4, 0.1.6, 0.1.7, 0.1.8, 0.1.10, 0.1.11, 0.1.12, 0.1.13, 0.1.14, 0.1.15, 0.2.0, 0.3.0, 0.3.7, 0.3.20, 0.4.0, 0.4.1, 0.6.0, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.2.0, 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5.1.2, 5.2.0b1, 5.2.0b2, 5.2.0b3, 5.2.0rc1, 5.2.0rc2, 5.2.0, 5.2.1, 5.2.2, 5.2.3, 5.2.4, 5.2.6, 5.2.7, 5.3.0a1, 5.3.0b1, 5.3.0b2, 5.3.0rc1, 5.3.0rc2, 5.3.0, 5.3.1, 5.3.4, 5.3.5, 5.3.6, 5.4.0rc1, 5.4.0rc2, 5.4.0, 5.5.0b1, 5.5.0b2, 5.5.0b3, 5.5.0b4, 5.5.0rc1, 5.5.0rc2, 5.5.0rc3, 5.5.0rc4, 5.5.0rc5)
ERROR: No matching distribution found for celery==3.1.26.post2
deepseek说是celery==3.1.26.post2 的元数据无效,降级 pip:
python -m pip install pip==23.3.1
提示降级成功
重新安装依赖仍然报错
pip install -r requirements.txt
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)'))': /simple/setuptools/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)'))': /simple/setuptools/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)'))': /simple/setuptools/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)'))': /simple/setuptools/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)'))': /simple/setuptools/
Could not fetch URL https://pypi.org/simple/setuptools/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/setuptools/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)'))) - skipping
ERROR: Could not find a version that satisfies the requirement setuptools==28.8.0 (from versions: none)
ERROR: No matching distribution found for setuptools==28.8.0
意思是pip 在尝试安装 setuptools==28.8.0 时遇到了 SSL 证书验证问题,导致无法连接到 PyPI 服务器
更换镜像后重新尝试:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
还是报错,再次执行安装依赖命令:
ecbc/anyjson-0.3.3.tar.gz (8.3 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [3 lines of output]
C:\Users\EDY\AppData\Local\Temp\pip-build-env-q1zv5q38\overlay\Lib\site-packages\setuptools\_distutils\dist.py:261: UserWarning: Unknown distribution option: 'test_suite'
warnings.warn(msg)
error in anyjson setup command: use_2to3 is invalid.
[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.
[notice] A new release of pip is available: 23.3.1 -> 25.0.1
[notice] To update, run: python.exe -m pip install --upgrade pip
再次执行安装命令
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
仍然报错:`pip install anyjson -i https://pypi.tuna.tsinghua.edu.cn/simple
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting anyjson
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/c3/4d/d4089e1a3dd25b46bebdb55a992b0797cff657b4477bc32ce28038fdecbc/anyjson-0.3.3.tar.gz (8.3 kB)
Installing build dependencies … done
Getting requirements to build wheel … error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [3 lines of output]
C:\Users\EDY\AppData\Local\Temp\pip-build-env-x7_sz00l\overlay\Lib\site-packages\setuptools_distutils\dist.py:261: UserWarning: Unknown distribution option: ‘test_suite’
warnings.warn(msg)
error in anyjson setup command: use_2to3 is invalid.
[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.
[notice] A new release of pip is available: 23.3.1 -> 25.0.1
[notice] To update, run: python.exe -m pip install --upgrade pip`
尝试降级安装:
pip install setuptools==58.0.0
安装成功后继续重新安装全部依赖:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
以下是其他报错
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