如果直接右键运行程序,并不会出现这样的问题,之后我尝试在terminal中使用pip install导入包,却出现错误信息:
error: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/itsdangerous.py'
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/v8/xx0fb7451z76_f99ffxshtdh0000gn/T/pip-build-QwdTFU/itsdangerous/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/v8/xx0fb7451z76_f99ffxshtdh0000gn/T/pip-dh5YgM-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/v8/xx0fb7451z76_f99ffxshtdh0000gn/T/pip-build-QwdTFU/itsdangerous/
Because if you right-click directly, it will run in the environment created by Pycharm. What runs in the terminal is the Python that comes with the system.
It is recommended to use virtualenv or pyenv to manage the python environment.