- “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 pyserial Requirement already satisfied (use --upgrade to upgrade): pyserial in c:\python27\lib\site-packages You 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 pip Collecting pip Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB) 100% |¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€| 1.3MB 80kB/s Installing collected packages: pip Found existing installation: pip 8.1.1 Uninstalling pip-8.1.1: Successfully uninstalled pip-8.1.1 Successfully installed pip-9.0.1
現在就可以使用pip安裝模塊了。
- 爽吧。。。