python学习点滴

来源:互联网 发布:淘宝如何换类目 编辑:程序博客网 时间:2024/05/17 04:30

1、安装qrcode:

N:\python\WXBot>weixin.py

Traceback (most recent call last):
  File "N:\python\WXBot\weixin.py", line 3, in <module>
    import qrcode
ImportError: No module named qrcode


N:\python\WXBot>c:


C:\>cd C:\Python27\Scripts


C:\Python27\Scripts>pip install qrcode
Collecting qrcode
  Using cached qrcode-5.3-py2.py3-none-any.whl
Collecting six (from qrcode)
  Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six, qrcode
Successfully installed qrcode-5.3 six-1.10.0
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' comm

and.


提示缺什么就装什么,非常方便。比如这个:ImportError: No module named requests


N:\python\WXBot>c:


C:\Python27\Scripts>pip install requests
Collecting requests
  Using cached requests-2.12.1-py2.py3-none-any.whl
Installing collected packages: requests
Successfully installed requests-2.12.1

这样就安装好了。


================如果网上的版本不对,可下载到本机.

遇到过自动下载库文件下载的不对的情况,lxml-3.4.4-cp26-none-win32.whl 中的cp26表示对应的python是2.6版本的,但是我们安装的Python是2.7版本的。所以库文件和python版本要对应好!

另外win32也表示对应的python版本是32位的,如果python是64位的话,则需要下载xml-3.6.4-cp27-cp27m-win64.whl

http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml


pip install N:\python\lxml-3.6.4-cp27-cp27m-win32.whl

C:\Python27\Scripts>pip install N:\python\lxml-3.6.4-cp27-cp27m-win32.whl
Processing n:\python\lxml-3.6.4-cp27-cp27m-win32.whl
Installing collected packages: lxml
Successfully installed lxml-3.6.4

0 0