Python pip安装问题 - 安装Twilio时出现Traceback错误

时间:2017-08-07 04:46:38

标签: python python-2.7 python-3.x pip

我尝试使用pip install twilio,也尝试$sudo pip install twilio,不断收到以下错误,无法在其他地方找到解决方案,请帮忙:

Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
    copy2(src, real_dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
    copystat(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
    os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-XS_kT9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pyOpenSSL-0.13.1-py2.7.egg-info'

2 个答案:

答案 0 :(得分:1)

再次安装python:

brew install python

然后尝试:

pip install twilio or sudo pip install twilio

答案 1 :(得分:0)

弄清楚了。 显然,我在Mac OS的默认Python 2.7之上安装了Python 3.6。因此,每当我执行pip install twilio时,它都会在Python3中安装pip时查看默认的2.7库。 所以我能够通过运行来解决它:

Python3 pip install twilio