Windows PowerShell
版权所有 (C) 2009 Microsoft Corporation。保留所有权利。
PS C:\Users\Administrator.ZHANGHAO-PC> D:
PS D:\> python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (
AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>> import xdrlib ,sys
导入失败,未安装 >>> import xlrd
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named xlrd
>>> import xdrlib ,sys
>>> exit
Use exit() or Ctrl-Z plus Return to exit
>>> exit()
PS D:\>
PS D:\>
需要输入参数
PS D:\> python ex15.py Traceback (most recent call last):
File "ex15.py", line 3, in
script, filename = argv
ValueError: need more than 1 value to unpack
读取文件
PS D:\> python ex15.py ex15_sample.txt
Here's your file 'ex15_sample.txt':
This is stuff I typed into a file.
It is really cool stuff.
Lots and lots of fun to have in here.
Type the filename again:
> ex15_sample.txt
This is stuff I typed into a file.
It is really cool stuff.
Lots and lots of fun to have in here.
PS D:\> cd xlrd-1.0.0
PS D:\xlrd-1.0.0> setup.py install
无法将“setup.py”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称
的拼写,如果包括路径,请确保路径正确,然后重试。
所在位置 行:1 字符: 9
+ setup.py <<<< install
+ CategoryInfo : ObjectNotFound: (setup.py:String) [], CommandNot
FoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: 未找到命令 setup.py,但它确实存在于当前位置。Windows Pow
erShell 默认情况下不从当前位置加载命令。如果信任此命令,请改为键入 ".\setup.py"
。有关更多详细信息,请参阅 "get-help about_Command_Precedence"。
PS D:\xlrd-1.0.0> dir
目录: D:\xlrd-1.0.0
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 2016-10-25 22:37 scripts
d---- 2016-10-25 22:37 tests
d---- 2016-10-25 22:37 xlrd
d---- 2016-10-25 22:37 xlrd.egg-info
-a--- 2016-6-3 9:45 107 .gitignore
-a--- 2016-6-3 9:45 680 .travis.yml
-a--- 2016-6-3 9:45 220 build.txt
-a--- 2016-6-3 9:45 13606 HISTORY.html
-a--- 2016-6-3 9:45 200 make_doc.bat
-a--- 2016-6-3 9:45 62 MANIFEST.in
-a--- 2016-6-3 9:46 994 PKG-INFO
-a--- 2016-6-3 9:45 695 pkg_doc.py
-a--- 2016-6-3 9:45 50164 pythondoc.py
-a--- 2016-6-3 9:45 3547 README.md
-a--- 2016-6-3 9:45 128 requirements.txt
-a--- 2016-6-3 9:46 59 setup.cfg
-a--- 2016-6-3 9:45 1767 setup.py
-a--- 2016-6-3 9:45 393 tox.ini
PS D:\xlrd-1.0.0>.\setup.py install
PS D:\xlrd-1.0.0> python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (
AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
安装成功,可以成功导入xlrd >>> import xlrd >>>