1.为了使用easy_install,先安装setuptools,https://pypi.python.org/pypi/setuptools/,然后使用如下办法安装setuptools:
python setup.py install
最后设置%PYTHON_HOME%/Scripts作为环境变量,以便使用easy_install这个命令
2. easy_install pip可以安装pip工具。pip工具室基于easy_install的,但是更多高级功能
3. 包管理工具easy_install, pip:
easy_install <package name>
pip install <package name>
easy_install不安装依赖包,而pip可以安装依赖包
4.pip 在编译的时候,要用到msvc,但是只寻找vc90,所以要把PythonHome\Lib\distutils\msvc9compiler.pymsvc9compiler.py中的243行改为:
if not productdir or not os.path.isdir(productdir):
#toolskey = "VS%0.f0COMNTOOLS" % version #comment this line
toolskey = "VS100COMNTOOLS" #add this line
toolsdir = os.environ.get(toolskey, None)
5.在pip install numpy的时候,会出现cannot link a simple c program,修复的办法是在msvc9compiler.py中的662行,改为:
mfinfo = None #add this line
if mfinfo is not None:
mffilename, mfid = mfinfo
6.在使用pip进行安装的时候,可能会出现:
Traceback (most recent call last):
File "D:\developer\Python27\Scripts\pip-script.py", line 9, in <module>
load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
File "D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\__init__
.py", line 148, in main
return command.main(args[1:], options)
File "D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\basecomm
and.py", line 169, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb1 in position 34: ordinal
not in range(128)
原因是因为Python的系统默认编码是ASCII,而我们需要用到的是GBK。解决办法,在C:\Python27\Lib\site-packages里面创建一个文件:sitecustomize.py
import sys
sys.setdefaultencoding('gbk')
这个文件会在python启动的时候自动执行