pip 更换国内镜像与记录

更换pip源到国内镜像

   阿里云 http://mirrors.aliyun.com/pypi/simple/ 
  中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 
  豆瓣(douban) http://pypi.douban.com/simple/ 
  清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 
  中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

注意后面要有simple目录!!!

临时使用: 
可以在使用pip的时候在后面加上-i参数,指定pip源 

pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple

永久修改:

window:创建或者修改在%HOMEPATH%\pip\pip.ini

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

怎么查看机器的%HomePath%

这样便可以直接打开对应的文件夹

本机win7,地址就上面。

================================================================================

pip安装模块:

λ pip install lxml
λ pip install pandas
λ pip install tushare

好吧,pip安装就这样,但是遇到一个问题,如果有很多要安装的模块咋办,而且我现在已经安装的,我到另外一个环境怎么办,然道再手动一个个安装?

解决方案,freeze

pip freeze 命令,按照一定的格式,输出已安装包列表,就相当于导出现在的安装列表

C:\Users\qhong
λ pip freeze > pip/requirements.txt

在上面我们设置国内源配置的文件夹pip下面,导出现在的pip安装列表

打开requirements.txt

aiohttp==2.2.5
aiomysql==0.0.9
async-timeout==1.4.0
beautifulsoup4==4.6.0
bs4==0.0.1
certifi==2017.7.27.1
chardet==3.0.4
click==6.7
Flask==0.12.2
idna==2.6
itsdangerous==0.24
Jinja2==2.9.6
lxml==3.8.0
MarkupSafe==1.0
multidict==3.1.3
numpy==1.13.1
olefile==0.44
pandas==0.20.3
Pillow==4.2.1
PyMySQL==0.7.11
python-dateutil==2.6.1
pytz==2017.2
requests==2.18.4
six==1.10.0
tushare==0.9.2
urllib3==1.22
virtualenv==15.1.0
Werkzeug==0.12.2
yarl==0.12.0

也可以通过pip list命令进行对比,发现是一样的。

那么怎么导入

C:\Users\qhong
λ pip install -r pip/requirements.txt

 

http://www.cnblogs.com/xueweihan/p/4981704.html

http://blog.csdn.net/chenghuikai/article/details/55258957

posted @ 2017-09-13 12:00  hongdada  阅读(467)  评论(0编辑  收藏  举报