广州双城热恋创意文化传播有限公司

现在的位置: 主页 > 在线留言 > 文章列表

文章正文

python修炼计划 从基本学起

作者:广州双城热恋创意文化传播有限公司 来源:www.999loveyou.com 发布时间:2017-09-03 12:47:52
python修炼计划 从基本学起

python修炼计划 从基本学起,学习一门热门语言。

计算机语言都是从hello world开始

Mac或Linux下自带python,windows需要安装,具体安装步骤问度娘。

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

#!/usr/bin/python

print "Hello, World!";

print "You can't imagine how powerful you are!";

需要加可执行权限,方法是在命令行下输入chmod +x helloworld.py

然后运行./helloworld.py

注意:

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

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

/usr/bin/python: No module named pip

解决方法是安装pip,

sudo easy_install pip

这样就可以安装pylint了

安装过程又出现

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

Collecting pylint

Using cached pylint-1.7.1-py2.py3-none-any.whl

Collecting astroid>=1.5.1 (from pylint)

Using cached astroid-1.5.3-py2.py3-none-any.whl

Collecting singledispatch; python_version < "3.4" (from pylint)

Using cached singledispatch-3.4.0.3-py2.py3-none-any.whl

Collecting mccabe (from pylint)

Using cached mccabe-0.6.1-py2.py3-none-any.whl

Collecting backports.functools-lru-cache; python_version == "2.7" (from pylint)

Using cached backports.functools_lru_cache-1.4-py2.py3-none-any.whl

Requirement already satisfied: 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 cached enum34-1.1.6-py2-none-any.whl

Collecting lazy-object-proxy (from astroid>=1.5.1->pylint)

Using cached lazy-object-proxy-1.3.1.tar.gz

Collecting wrapt (from astroid>=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

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

企业建站2800元起,携手武汉肥猫科技,做一个有见地的颜值派!更多优惠请戳:神农架网站建设 http://shennongjia.45qun.com

COPYRIGHT © 2015 广州双城热恋创意文化传播有限公司 ALL RIGHTS RESERVED. 网站地图 技术支持:肥猫科技
精彩专题:网站建设
购买本站友情链接、项目合作请联系客服QQ:2500-38-100