换了台电脑,在mac和linux环境安装python环境都很特别简单,在windows下折腾了好久,最后记录下,
卸载旧版,用choco工具直接安装
$ choco install python2
Chocolatey v0.10.15
Installing the following packages:
python2
By installing you accept licenses for the packages.
python2 v2.7.18 already installed.
Use --force to reinstall, specify a version to install, or try upgrade.
Chocolatey installed 0/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Warnings:
- python2 - python2 v2.7.18 already installed.
Use --force to reinstall, specify a version to install, or try upgrade.
Did you know the proceeds of Pro (and some proceeds from other
licensed editions) go into bettering the community infrastructure?
Your support ensures an active community, keeps Chocolatey tip top,
plus it nets you some awesome features!
https://chocolatey.org/compare
运行pip
$ pip list
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Package Version
---------- -------
pip 19.2.3
setuptools 41.2.0
WARNING: You are using pip version 19.2.3, however version 20.2.4 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
到这里就算已经安装完成了,后面,安装一些项目中用到的模块,加上下载源
如下
pip install pycrypto -i https://mirrors.ustc.edu.cn/pypi/web/simple/
No module named Crypto.Cipher
$ pip install pycrypto
ImportError: No module named tornado.httpserver
$ pip install tornado==4.1
ImportError: No module named sqlalchemy
$ pip install SQLAlchemy==1.1.9 # 新旧版本区别
ImportError: No module named redis
$ pip install redis
ImportError: No module named wtforms
$ pip install WTForms
ImportError: No module named pinyin
$ pip install pinyin
ImportError: No module named lxml
$ pip install lxml
ImportError: No module named xlwt
$ pip install xlwt
ImportError: No module named xlrd
$ pip install xlrd
ImportError: No module named dateutil.parser
$ pip install python-dateutil
ImportError: No module named wtforms_json
$ pip install WTForms-JSON
ImportError: No module named PIL
$ pip install Pillow