python - 在terminal中启动程序时,为何会出现未导入包的错误?
大家讲道理
大家讲道理 2017-04-18 09:54:27
0
1
376

如果直接右键运行程序,并不会出现这样的问题,之后我尝试在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/
大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
巴扎黑

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template