- “Win +R”打开cmd终端,如果直接在里面使用pip命令的时候,要么出现“syntax invalid”,要么出现:
-
'pip' is not recognized as an internal or external command, operable program or batch file.
此时需要将C:\Python27\Scripts添加到系统环境变量,我顺便将C:\Python27\python.exe也添加进了系统环境变量,要保证echo %PATH%能看到对应的目录。
- 再使用pip install pyserial就可以安装serial模块了,不过我的右如下提示,说我的版本过旧:
-
C:\Users\h144197>pip install pyserialRequirement already satisfied (use --upgrade to upgrade): pyserial in c:\python27\lib\site-packagesYou are using pip version 8.1.1, however version 9.0.1 is available.You should consider upgrading via the 'python -m pip install --upgrade pip' command.
照着提示做就好了,类似于linux下的shell。
-
C:\Users\h144197>python -m pip install --upgrade pipCollecting pip Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB) 100% |¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€| 1.3MB 80kB/sInstalling collected packages: pip Found existing installation: pip 8.1.1 Uninstalling pip-8.1.1: Successfully uninstalled pip-8.1.1Successfully installed pip-9.0.1
现在就可以使用pip安装模块了。
- 爽吧。。。