python修炼计划 从基本学起1

学习一门热门语言

计算机语言都是从helloworld开始

MacLinux下自带Python,windows需要安装,具体安装步骤问度娘。

建立python脚本如下,vim helloword.py

 

 

#!/usr/bin/python

 

#coding=utf-8

 



#剽悍的代不需要解析

 

#解析也没用就那么几行没人看

 

print'Hello Python!'

 

print'个世界小小python'

 

print'You can\'t imagine how powerful you are!'

 

然后运行pythonhelloworld.py

 

注意:

在Mac下安装pylint可能遇到点问题,

luntekiMBP:pythonapple$ /usr/bin/python -m pip install pylint

/usr/bin/python: Nomodule named pip

解决方法是安装pip,

sudo easy_install pip

这样就可以安装pylint

安装过程又出现

AluntekiMBP:pythonapple$ /usr/bin/python -m pip install pylint
Collecting pylint

  Using cachedpylint-1.7.1-py2.py3-none-any.whl
Collecting astroid>=1.5.1 (from pylint)
  Using cachedastroid-1.5.3-py2.py3-none-any.whl
Collecting singledispatch; python_version <"3.4" (from pylint)
  Using cachedsingledispatch-3.4.0.3-py2.py3-none-any.whl
Collecting mccabe (from pylint)
  Using cachedmccabe-0.6.1-py2.py3-none-any.whl
Collecting backports.functools-lru-cache;python_version == "2.7" (from pylint)
  Using cachedbackports.functools_lru_cache-1.4-py2.py3-none-any.whl

Requirement alreadysatisfied: six in/System/Library/Frameworks/Python.framework/Versions/2.7/Extra

s/lib/python(from pylint)
Collecting isort>=4.2.5 (from pylint)

  Using cached isort-4.2.15-py2.py3-none-any.whl
Collecting configparser; python_version =="2.7" (from pylint)
  Using cached configparser-3.5.0.tar.gz
Collecting enum34>=1.1.3; python_version <"3.4" (from astroid>=1.5.1->pylint)
  Using cachedenum34-1.1.6-py2-none-any.whl
Collecting lazy-object-proxy (fromastroid>=1.5.1->pylint)
  Using cachedlazy-object-proxy-1.3.1.tar.gz
Collecting wrapt (fromastroid>=1.5.1->pylint)
  Using cached wrapt-1.10.10.tar.gz
Installing collected packages: enum34,singledispatch, lazy-object-proxy, backports.functools-lru-ca
che, wrapt, astroid, mccabe, isort,configparser, pylint

Exception:

raceback(most recent call last):
  File"/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py",line 215, in main

    status = self.run(options, args)
  File"/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py",line 342, in
 run
    prefix=options.prefix_path,
  File"/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py",line 784, in inst
all
    **kwargs
  File"/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py",line 851, in
install

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

 File"/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py",line 1064, in

 move_wheel_files
    isolated=self.isolated,
  File"/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py",line 345, in move_wheel
_files
    clobber(source, lib_dir, True)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py",line 316, in clobber
    ensure_dir(destdir)
  File"/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py",line 83, in en
sure_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/enum'

这个应该是权限错误。

没办法一个个创建文件夹,比如在/Library/Python/2.7/site-packages/下执行

sudo mkdir enum

后面的权限报错一样的处理方法,一步步试验,直到安装成功

其实不用这么麻烦

sudo /usr/bin/python -mpip install pylint

就可以了

 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值