在Windows环境下安装sandman2 可能会在pip install sanman2后出现
sandman2 : 无法将“sandman2”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。
请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次
这时候你需要看一下在pip时是否有类似这样的警告
WARNING: The script sandman2ctl.exe is installed in 'C:\Users\xxx\AppData\Roaming\Python\Python38\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning,
use --no-warn-script-location.
这时候你需要将绿色的路径加入系统的环境变量即可调用sandman2ctl
如果在调用sandman2ctl报如下错误
File "c:\programdata\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
····
File "C:\Users\xxx\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\util\_collections.py", line 16, in < from .compat import binary_types
File "C:\Users\xxx\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\util\compat.py", line 331, in <module>
time_func = time.clock
AttributeError: module 'time' has no attribute 'clock'
请将文件定位到 C:\Users\xxx\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\util\compat.py
compat.py 这个文件,打开它 做如下修改:
第331行代码
# 修改前
if win32 or jython:
time_func = time.clock # ← 替换为time.perf_counter()
else:
time_func = time.time
# 修改后
if win32 or jython:
time_func = time.perf_counter()
else:
time_func = time.time
该错误的原因是python3.8不在有对clock的支持