在 mac 终端上 运行 source venv.source 时遇到语法错误

Facing syntax error while running source venv.source on mac terminal

我是 运行 "source venv.source" 在我的 Mac 终端中从 Github 克隆的存储库中的命令,有人可以帮助我吗。

=========================================
Activating virtual environment
=========================================
Executing: source /Users/jillasai.krishna/test_data_venv/bin/activate
Done

=========================================
Installing requirements inside virtual environment
=========================================
Executing: pip install -r /Users/jillasai.krishna/pi-tcms-1/pi-tcms/requirements.txt
Collecting cheetah==2.4.4
  Using cached https://files.pythonhosted.org/packages/cd/b0/c2d700252fc251e91c08639ff41a8a5203b627f4e0a2ae18a6b662ab32ea/Cheetah-2.4.4.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /Users/jillasai.krishna/test_data_venv/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4b/6t4qhtp51zlg9dqbh8hv743c0000gp/T/pip-install-y1gjebi8/cheetah/setup.py'"'"'; __file__='"'"'/private/var/folders/4b/6t4qhtp51zlg9dqbh8hv743c0000gp/T/pip-install-y1gjebi8/cheetah/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/4b/6t4qhtp51zlg9dqbh8hv743c0000gp/T/pip-install-y1gjebi8/cheetah/pip-egg-info
         cwd: /private/var/folders/4b/6t4qhtp51zlg9dqbh8hv743c0000gp/T/pip-install-y1gjebi8/cheetah/
    Complete output (8 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/4b/6t4qhtp51zlg9dqbh8hv743c0000gp/T/pip-install-y1gjebi8/cheetah/setup.py", line 10, in <module>
        import SetupTools
      File "/private/var/folders/4b/6t4qhtp51zlg9dqbh8hv743c0000gp/T/pip-install-y1gjebi8/cheetah/SetupTools.py", line 50
        except DistutilsPlatformError, x:
                                     ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Done

Could not install all the requirements


期望设置 venv 成功,但 运行 出现上述错误。

/Users/jillasai.krishna/pi-tcms-1/pi-tcms/requirements.txt 包含 cheetah==2.4.4。此版本的 Cheetah 仅适用于 Python2,您正尝试与 Python3.

一起使用

要么将项目与 Python 2.7 一起使用,要么将项目升级到 Python 3。Cheetah3 同时支持 Python 2.7 和 3.4+。

首先要尝试将 cheetah==2.4.4 替换为 Cheetah3==3.2.4