国内各个镜像地址

Python013

国内各个镜像地址,第1张

公司类

搜狐开源镜像站: http://mirrors.sohu.com/

网易开源镜像站: http://mirrors.163.com/

开源中国: http://mirrors.oschina.net/

首都在线科技股份有限公司: http://mirrors.yun-idc.com/

阿里云开源镜像: http://mirrors.aliyun.com/

LUPA: http://mirror.lupaworld.com/

常州贝特康姆软件技术有限公司(原cn99): http://centos.bitcomm.cn/

大学类

中山大学镜像: http://mirror.sysu.edu.cn/

山东理工大学: http://mirrors.sdutlinux.org/

哈尔滨工业大学: http://run.hit.edu.cn/

中国地质大学: http://cugbteam.org/

大连理工大学: http://mirror.dlut.edu.cn/

西南林业大学  http://cs3.swfu.edu.cn/cs3guide.html

北京化工大学(仅教育网可以访问),包含 CentOS 镜像: http://ubuntu.buct.edu.cn/

天津大学: http://mirror.tju.edu.cn/

西南大学: http://linux.swu.edu.cn/swudownload/Distributions/

青岛大学: http://mirror.qdu.edu.cn/

南京师范大学: http://mirrors.njnu.edu.cn/

大连东软信息学院:  http://mirrors.neusoft.edu.cn/

浙江大学: http://mirrors.zju.edu.cn/

兰州大学: http://mirror.lzu.edu.cn/

厦门大学: http://mirrors.xmu.edu.cn/

北京理工大学:

http://mirror.bit.edu.cn  (IPv4 only)

http://mirror.bit6.edu.cn  (IPv6 only)

北京交通大学:

http://mirror.bjtu.edu.cn  (IPv4 only)

http://mirror6.bjtu.edu.cn  (IPv6 only)

http://debian.bjtu.edu.cn  (IPv4+IPv6)

上海交通大学:

http://ftp.sjtu.edu.cn/  (IPv4 only)

http://ftp6.sjtu.edu.cn  (IPv6 only)

清华大学:

http://mirrors.tuna.tsinghua.edu.cn/  (IPv4+IPv6)

http://mirrors.6.tuna.tsinghua.edu.cn/  (IPv6 only)

http://mirrors.4.tuna.tsinghua.edu.cn/  (IPv4 only)

中国科学技术大学:

http://mirrors.ustc.edu.cn/  (IPv4+IPv6)

http://mirrors4.ustc.edu.cn/

http://mirrors6.ustc.edu.cn/

东北大学:

http://mirror.neu.edu.cn/  (IPv4 only)

http://mirror.neu6.edu.cn/  (IPv6 only)

华中科技大学:

http://mirrors.hust.edu.cn/

http://mirrors.hustunique.com/

电子科技大学: http://ubuntu.uestc.edu.cn/

电子科大凝聚工作室(Raspbian单一系统镜像)  http://raspbian.cnssuestc.org/

电子科大星辰工作室(少数小众发布版镜像)  http://mirrors.stuhome.net/

PyPi 镜像

豆瓣: http://pypi.douban.com/

山东理工大学: http://pypi.sdutlinux.org/

中山大学: http://mirror.sysu.edu.cn/pypi/

V2EX: http://pypi.v2ex.com/simple/

RubyGems 镜像

中山大学: http://mirror.sysu.edu.cn/rubygems/

山东理工大学: http://ruby.sdutlinux.org/

淘宝网: http://ruby.taobao.org/

npm 镜像

cnpmjs: http://cnpmjs.org/

一、概要

iOS开发时,项目中会引用许多第三方库,CocoaPods(https://github.com/CocoaPods/CocoaPods)可以用来方便的统一管理这些第三方库(从一个坑出来,又进了另一个坑而已……)。

二、安装

由于网上的教程基本都大同小异,但细节之处还不是很完善,所以借机会在这里补充下:

注:要使用CocoaPods,那就要下载安装它,而下载安装CocoaPods需要Ruby环境

1、Ruby环境搭建

当前安装环境为Mac mini 10.8.5。Mac OS本身自带Ruby,但还是更新一下保险,因为我第一次安装在没有更新Ruby的情况下就失败了。

a 查看下当前ruby版本:打开终端输入 ruby -v(确实安装了,不过用这个版本接下来工作失败了,所以更新下ruby)

[objc] view plain copy print?

ritekiMac-mini:PodTest lucky$ ruby -v

ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

ritekiMac-mini:PodTest lucky$

b 更新ruby

终端输入如下命令(把Ruby镜像指向taobao,避免被墙,你懂得)

gem sources --remove https://rubygems.org/

gem sources -a http://ruby.taobao.org/

gem sources -l (用来检查使用替换镜像位置成功)

[objc] view plain copy print?

ritekiMac-mini:~ lucky$ gem sources --remove https://rubygems.org/

https://rubygems.org/ removed from sources

ritekiMac-mini:~ lucky$ gem sources -a http://ruby.taobao.org/

http://ruby.taobao.org/ added to sources

ritekiMac-mini:~ lucky$ gem sources -l

*** CURRENT SOURCES ***

补充:(2016-01-20更新)

淘宝已经关闭HTTP协议的景象服务,改为HTTPS协议。

淘宝ruby地址:https://ruby.taobao.org/

2、下载安装CocoaPods

终端输入:sudo gem install cocoapods

[html] view plain copy print?

ritekiMac-mini:~ lucky$ sudo gem install cocoapods

CHANGELOG:

## 0.32.1

##### Bug Fixes

* Fixed the Podfile `default_subspec` attribute in nested subspecs.

[Fabio Pelosin][irrationalfab]

\ [#2050](https://github.com/CocoaPods/CocoaPods/issues/2050)

Successfully installed cocoapods-0.32.1

Installing ri documentation for cocoapods-0.32.1

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rdoc/rdoc.rb:280: warning: conflicting chdir during another chdir block

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rdoc/rdoc.rb:287: warning: conflicting chdir during another chdir block

Done installing documentation for cocoapods after 10 seconds

1 gem installed

这样就下载安装好了CocoaPods

3、使用CocoaPods

a 新建一个项目,名字PodTest

b 终端中,cd到项目总目录(注意:包含PodTest文件夹、PodTest.xcodeproj、PodTestTest的那个总目录)

[objc] view plain copy print?

cd /Users/lucky/Desktop/PodTest

c 建立Podfile(配置文件)

接着上一步,终端输入 vim Podfile

键盘输入 i,进入编辑模式,输入

platform :ios, ‘7.0‘

pod ‘MBProgressHUD‘, ‘~>0.8‘

然后按Esc,并且输入“ :”号进入vim命令模式,然后在冒号后边输入wq

注意:键盘输入 :后,才能输入wq。回车后发现PodTest项目总目录中多一个Podfile文件

激动人心的时刻到了:确定终端cd到项目总目录,然后输入 pod install,等待一会,大约3分钟。

查看项目根目录:

注意:现在打开项目不是点击 PodTest.xodeproj了,而是点击 PodTest.xcworkspace

对于工程发生的变化,有几点需要说明:

a、第三方库会以成静态库方式引入工程使用

CocoaPods会将所有的第三方库以target的方式组成一个名为Pods的工程,该工程就放在刚才新生成的Pods目录下。整个第三方库工程会生成一个名称为libPods.a的静态库提供给工程使用。

b、xcworkspace(PodTest.xcworkspace)的作用是管理工程和第三方库

PodTest工程和Pods工程被以workspace的形式组织和管理。

打开项目后看到项目结构并且测试一下:

运行结果:

补充:

1、CocoaPods的基本安装及使用都详细的说明了,但还有一些补充,当需要同时导入多个第三方时候怎么办 ?

这就需要修改Podfile了,就是用vim编辑的那个保存在项目根目录中的文件,修改完了Podfile文件,需要重新执行一次pod install命令。

例如:

platform :ios

pod ‘JSONKit‘, ‘~>1.4‘

pod ‘AFNetworking‘, ‘~>2.0‘

2、CocoaPods可以查找你想要的第三方库

终端输入命令:pod search UI

疯了了,我怎么查找这么大众的关键字,好多库~~

然后重新编辑Podfile文件,按照之前的步骤,把更多的库都导入项目!

3、上文中“建立Podfile(配置文件)接着上一步,终端输入 vim Podfile”步骤,如果不习惯使用vim编辑器,也可以使用linux命令touch,生成一个空的Podfile文件,然后使用其他的文本编辑器都可以,例如:

[objc] view plain copy print?

lizhongfudeMacBook-Pro:~ lizhongfu$ cd /Users/lizhongfu/Desktop/TestProject

lizhongfudeMacBook-Pro:TestProject lizhongfu$ touch Podfile

编辑好Podfile文件后,就可以执行pod install第三方导入了(详见:补充第1条),CocoaPods就开始为我们做下载源码、配置依赖关系、引入需要的framework等一些列工作。

4、如果已经生成了CocoaPods管理的工程,则可以在Xcode中编辑Podfile,编辑保存后,别忘记cd到根目录,调用pod install命令

5、项目存在多个Target的时候,需要配置Podfile文件来支持新增加的Target,否则只支持项目默认建立时生成的Target:

a、如果新建一个Target,命名为Second,并且Second与Test两个Target所需要的第三方支持相同,也就是使用相同的Pods依赖库,则可以使用

link_with关键字:

[objc] view plain copy print?

link_with ‘Test‘, ‘Second‘

platform :ios

platform :ios, ‘9.0’

pod ‘AFNetworking‘, ‘~>2.0‘

b、如果不同的Target需要不同的依赖库,则可以

[objc] view plain copy print?

platform :ios

target :‘Test‘ do

pod ‘Reachability‘

pod ‘SBJson‘

pod ‘AFNetworking‘

end

target :‘Second‘ do

pod ‘OpenUDID‘

end

6、出现/Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:417:in `help!‘: [!] You cannot run CocoaPods as root. (CLAide::Help)

重新打开一个终端,然后pod install,不要sudo pod install。

7、如果$ pod install时候遇到:

Analyzing dependencies

Fetching podspec for `UAAppReviewManager` from `..`

[!] Unable to satisfy the following requirements:

- `UAAppReviewManager (from `..`)` required by `Podfile`

8、如果要移除Cocoapods,则可以:

a. 删除工程文件夹下的Podfile、Podfile.lock及Pods文件夹

b. 删除xcworkspace文件

c. 使用xcodeproj文件打开工程,删除Frameworks组下的Pods.xcconfig及libPods.a引用

d. 在工程设置中的Build Phases下删除Check Pods Manifest.lock及Copy Pods Resources