Mac下安装pip报错

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/beijihukk/article/details/53398438

python完全不了解,今天根据教程装好python,附上参考链接 在Mac OSX中搭建Python集成开发环境图解 – 码农网

然后想调试一个程序,说要装pip,于是上python官网,点开pypi



密密麻麻一片,看不太懂是什么,于是点开左侧导航中的PyPI Tutorial进去看看


第一段说当前文档不再维护,有更新的资料并给出了链接,直接点进去了


pip是用于安装和管理python包的工具,那Installing Packages应该有些信息是我要的,点进去


在目录第第二条就看到的安装pip的描述,点进去,往下看很快就找到安装pip的描述


根据文档的描述,打开终端输pip install -U pip setup tools,提示pip不是命令,我没仔细研究,采用下方的otherwise中的方法,下载get-pip.py,然后用终端执行,

Last login: Tue Nov 29 19:27:00 on ttys001

192:Downloads lishengda$ python get-pip.py

Collecting pip

  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)

    100% |████████████████████████████████| 1.3MB 95kB/s 

Collecting wheel

  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)

    100% |████████████████████████████████| 71kB 89kB/s 

Installing collected packages: pip, wheel

Exception:

Traceback (most recent call last):

  File "/var/folders/wz/_d4crmhd0nn5qlffdt3s4c3c0000gp/T/tmpRARzV1/pip.zip/pip/basecommand.py", line 215, in main

    status = self.run(options, args)

  File "/var/folders/wz/_d4crmhd0nn5qlffdt3s4c3c0000gp/T/tmpRARzV1/pip.zip/pip/commands/install.py", line 342, in run

    prefix=options.prefix_path,

  File "/var/folders/wz/_d4crmhd0nn5qlffdt3s4c3c0000gp/T/tmpRARzV1/pip.zip/pip/req/req_set.py", line 784, in install

    **kwargs

  File "/var/folders/wz/_d4crmhd0nn5qlffdt3s4c3c0000gp/T/tmpRARzV1/pip.zip/pip/req/req_install.py", line 851, in install

    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)

  File "/var/folders/wz/_d4crmhd0nn5qlffdt3s4c3c0000gp/T/tmpRARzV1/pip.zip/pip/req/req_install.py", line 1064, in move_wheel_files

    isolated=self.isolated,

  File "/var/folders/wz/_d4crmhd0nn5qlffdt3s4c3c0000gp/T/tmpRARzV1/pip.zip/pip/wheel.py", line 345, in move_wheel_files

    clobber(source, lib_dir, True)

  File "/var/folders/wz/_d4crmhd0nn5qlffdt3s4c3c0000gp/T/tmpRARzV1/pip.zip/pip/wheel.py", line 316, in clobber

    ensure_dir(destdir)

  File "/var/folders/wz/_d4crmhd0nn5qlffdt3s4c3c0000gp/T/tmpRARzV1/pip.zip/pip/utils/__init__.py", line 83, in ensure_dir

    os.makedirs(path)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs

    mkdir(name, mode)

OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip'


报错,不知何故,想起来我装的python是3.4,于是把指令换成python3 get-pip.py试了下,果然通过。

192:Downloads lishengda$ python3 get-pip.py

Collecting pip

  Using cached pip-9.0.1-py2.py3-none-any.whl

Collecting wheel

  Using cached wheel-0.29.0-py2.py3-none-any.whl

Installing collected packages: pip, wheel

  Found existing installation: pip 8.1.1

    Uninstalling pip-8.1.1:

      Successfully uninstalled pip-8.1.1

Successfully installed pip-9.0.1 wheel-0.29.0

192:Downloads lishengda$ 


未及深究,很多地方带猜的,先记下,以后明白了再更新

展开阅读全文

没有更多推荐了,返回首页