运行pypy时,即使epto.py和conf_epto位于目录C:\ Users \ Acer \ pypy2.7-v7.0.0-win32中,我也会在下面遇到无效的语法错误。
(snakes) C:\Users\Acer\pypy2.7-v7.0.0-win32>pip install PyYaml
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting PyYaml
Downloading https://files.pythonhosted.org/packages/1a/d6/b082e72e4556c2ef3dd9ec122f886b341187d677f32ee3081888762ab38d/PyYAML-5.1-cp27-cp27m-win_amd64.whl (210kB)
100% |################################| 215kB 297kB/s
Installing collected packages: PyYaml
Successfully installed PyYaml-5.1
(snakes) C:\Users\Acer\pypy2.7-v7.0.0-win32>pypy epto.py conf_epto 1
Traceback (most recent call last):
File "epto.py", line 14, in <module>
import yaml
ImportError: No module named yaml
按照建议,我安装了PyYaml软件包,然后在pypy控制台之外再次运行,如下所示:
School school = new School();
school.createNewStudent();