lihu129c 发表于 2018-6-23 06:50:21

Python在windows下安装

  1. 用浏览器打开 http://notepad-plus-plus.org/ 下载并安装 Notepad++ 文本编辑器。这个操作无需管理员权限。
  2. 把 Notepad++ 放到桌面或者快速启动栏,这样你就可以方便地访问到该程序了。这两条在安装选项中可以看到。
  3. 从开始菜单运行“PowerShell”程序。你可以使用开始菜单的搜索功能,输入名称后敲回车即可打开。(没有安装PowerShell,请到这里下载http://mydown.yesky.com/soft/develop/others/254/468254.shtml)
  4. 为它创建一个快捷方式,放到桌面或者快速启动栏中以方便使用。
  5. 运行命令行终端程序(也就是 PowerShell),这个程序看上去不怎么地。
  6. 在命令行终端里边运行 python。运行的方法是输入程序的名字再敲一下回车。
  1. 如果你运行 python 发现它不存在(python 不是可执行命令,或者系统找不到python 云云)。你需要访问 http://python.org/download 并且安装 Python。
  4. 如果你安装好了但是 python 还是不能被识别,那你需要在 powershell 下输入并执行以下命令:
  ::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User")
  5. 关闭并重启 powershell,确认 python 现在可以运行。如果不行的话你可能需要重启电脑。
  6.In your PowerShell (Terminal) program, run python.You run things in Terminal by just typing the name and hitting Enter.

[*]
[*]  If you run python and it's not there (python is not recognized..).Install it from http://python.org/download.
[*]  Make sure you install Python 2, not Python 3.
[*]  You may be better off with ActiveState Python especially when you do not have Administrative rights
[*]  If after you install it python still isn't recognized then in PowerShell enter this:
  ::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User")

[*]  Close PowerShell and then start it again to make sure Python now runs.If it doesn't, restart may be required.

  7. 键入 CTRL-Z (^Z),再敲回车以退出 python。
  8. 这样你就应该退回到敲 python 前的提示界面了。如果没有的话自己研究一下为什么。
  9. 学着使用 Terminal 创建一个目录,你可以上网搜索怎样做。
  10.学着使用 Terminal 进入一个目录。同样你可以上网搜索。
  11.使用你的编辑器在你进入的目录下建立一个文件。你将建立一个文件,使用 “Save” 或者“Save As...” 选项,然后选择这个目录。
  12.使用键盘切换回到 Terminal 窗口,如果不知道怎样使用键盘切换,你一样可以上网搜索。
  13.回到 Terminal,看看你能不能使用命令看到你新建的文件,上网搜索如何将文件夹中的内容列出来。
  Warning
  有时这一步你会漏掉:Windows 下装了 Python 但是没有正确配置路径。确认你在 powershell 下输入了 ::SetEnvironmentVariable("Path","$env:Path;C:\Python27", "User")。你也许需要重启 powershell 或者计算机来让路径设置生效。
  Windows: 你应该看到的结果
  > python      ActivePython 2.6.5.12 (ActiveState Software Inc.) based on    Python 2.6.5 (r265:79063, Mar 20 2010, 14:22:52) on    win32    Type "help", "copyright", "credits" or "license" for more information.
  >>> ^Z
  > mkdir mystuff
  > cd mystuff    ... 使用 Notepad++ 编辑 mystuff 目录下的 test.txt ...    >
  <如果你没有使用管理员权限安装,你会看到一堆错误。忽略它们,按回车即可。>
  > dir   Volume in drive C is   Volume Serial Number is 085C-7E02   Directoryof C:\Documents and Settings\you\mystuff    04.05.201023:32
  <DIR>          .    04.05.201023:32
  <DIR>          ..   04.05.201023:32               6 test.txt
  1 File(s)            6 bytes
  2 Dir(s)14 804 623 360 bytes free
  >
  -----整理自‘http://learnpythonthehardway.org/book/ex0.html’
页: [1]
查看完整版本: Python在windows下安装