{"id":2001,"date":"2015-03-14T10:48:13","date_gmt":"2015-03-14T02:48:13","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=2001"},"modified":"2015-03-14T10:48:13","modified_gmt":"2015-03-14T02:48:13","slug":"pypi%e5%92%8cpip","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/2001.html","title":{"rendered":"PyPI\u548cPIP"},"content":{"rendered":"<p>PyPI &#8211; the Python Package Index &#8211; Python\u5305\u7d22\u5f15\uff0c\u4ece\u540d\u5b57\u4e0a\u5c31\u53ef\u4ee5\u770b\u51fa\u5b83\u7684\u4f5c\u7528\uff0c\u5982\u679c\u4f60\u9700\u8981\u641c\u7d22Python\u662f\u5426\u6709\u67d0\u4e2a\u529f\u80fd\u7684\u5b9e\u73b0\/\u73b0\u6210\u6a21\u5757\u7684\u8bdd\u5c31\u53ef\u4ee5\u53bb<a href=\"https:\/\/pypi.python.org\/pypi\" target=\"_blank\">PyPI\u7684\u5b98\u7f51<\/a>\u4e0a\u641c\uff0c\u5b89\u5168\u9ad8\u6548\uff1b<\/p>\n<p>PIP &#8211; \u4e00\u4e2a\u7b80\u5316\u5b89\u88c5Python\u5305\u7684\u5de5\u5177\uff08The <a href=\"https:\/\/python-packaging-user-guide.readthedocs.org\/en\/latest\/current.html\" target=\"_blank\">PyPA recommended<\/a> tool for installing Python packages.\uff09\uff0c\u65b9\u4fbf\u81f3\u6781\u3002<\/p>\n<p>\u4f46\u6bd5\u7adfPIP\u662f\u5728\u7ebf\u5b89\u88c5\u7684\u65b9\u5f0f\uff0c\u5b89\u88c5\u901f\u5ea6\u4f9d\u8d56\u4e8e\u7f51\u7edc\u72b6\u51b5\uff0c\u7279\u522b\u662f\u5728\u56fd\u5185\u65f6\u4e0d\u65f6\u4f1a\u62bd\u62bd\u98ce\uff0c\u8fd9\u65f6\uff0c\u4f60\u5c31\u9700\u8981\u4e86\u89e3\u4e00\u4e0b\u5982\u4f55\u8bbe\u7f6ePIP\u6765\u5e2e\u52a9\u907f\u514d\u8fd9\u79cd\u95ee\u9898\u4e86\uff1b\u5982\u679c\u662f\u516c\u53f8\u5185\u90e8\u4f7f\u7528\u7684\u8bdd\uff0c\u8fd8\u63a8\u8350\u7528 <a href=\"https:\/\/pypi.python.org\/pypi\/pypiserver\" target=\"_blank\">https:\/\/pypi.python.org\/pypi\/pypiserver<\/a> \u642d\u5efa\u4e00\u4e2a\u7b80\u5355\u7684pypi\u670d\u52a1\u5668\uff0c\u7136\u540e\u5728\u81ea\u5df1\u7684\u673a\u5668\u4e0a\u8bbe\u7f6e\u4e00\u4e0b ~\/.pip\/pip.conf \u548c ~\/.pypirc \u5c31\u53ef\u4ee5\u6109\u5feb\u7684\u4f7f\u7528\u4e86\u3002<\/p>\n<p>==<\/p>\n<h6>\u8bbe\u7f6e ~\/.pip\/pip.conf<\/h6>\n<pre class=\"lang:default decode:true\">[global]\nindex-url = http:\/\/pypi.mirrors.ustc.edu.cn\/simple\/<\/pre>\n<p>=\u66f4\u591a\u7684\u56fd\u5185PIP\u6e90=<\/p>\n<pre class=\"lang:default decode:true\">https:\/\/pypi.python.org\/simple\/\nhttp:\/\/pypi.v2ex.com\/simple\/\nhttp:\/\/pypi.douban.com\/simple\/\nhttp:\/\/mirrors.tuna.tsinghua.edu.cn\/pypi\/web\/simple\/<\/pre>\n<p>\u7136\u540e\u76f4\u63a5\u4f7f\u7528pip\u5373\u53ef\u3002<\/p>\n<h6>\u8bbe\u7f6esetuptools\u7684\u6e90\u7684\u65b9\u6cd5[\u7f16\u8f91 ~\/.pydistutils.cfg ]<\/h6>\n<pre class=\"lang:default decode:true \">[easy_install]\nindex_url = http:\/\/pypi.mirrors.ustc.edu.cn\/simple\/<\/pre>\n<h6>\u76f4\u63a5cli\u6307\u5b9a<\/h6>\n<pre class=\"lang:default decode:true\">$ pip install -i http:\/\/pypi.mirrors.ustc.edu.cn\/simple Flask<\/pre>\n<p>====<\/p>\n<h6>\u67e5\u627e\u67d0\u4e2apackage\u662f\u5426\u5728PIP\u7684\u6e90\u4e2d(pip search package_name)<\/h6>\n<pre class=\"lang:default decode:true\"># pip search --help\n\nUsage:\n  pip search [options] &lt;query&gt;\n\nDescription:\n  Search for PyPI packages whose name or summary contains &lt;query&gt;.\n\nSearch Options:\n  --index &lt;url&gt;               Base URL of Python Package Index (default https:\/\/pypi.python.org\/pypi)\n\nGeneral Options:\n  -h, --help                  Show help.\n  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.\n  -V, --version               Show version and exit.\n  -q, --quiet                 Give less output.\n  --log-file &lt;path&gt;           Path to a verbose non-appending log, that only logs failures. This log is active by\n                              default at \/root\/.pip\/pip.log.\n  --log &lt;path&gt;                Path to a verbose appending log. This log is inactive by default.\n  --proxy &lt;proxy&gt;             Specify a proxy in the form [user:passwd@]proxy.server:port.\n  --timeout &lt;sec&gt;             Set the socket timeout (default 15 seconds).\n  --exists-action &lt;action&gt;    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.\n  --cert &lt;path&gt;               Path to alternate CA bundle.<\/pre>\n<p>====<\/p>\n<h6>\u5f80\u67d0\u4e2apypi\u670d\u52a1\u5668\u4e0a\u4f20package<\/h6>\n<ul>\n<li>\u5148\u8bbe\u7f6e\u597d ~\/.pypirc :<\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\">[distutils]\nindex-servers =\n    internal\n\n[internal]\nrepository: http:\/\/localhost:8000\/simple\/\nusername: root\npassword: password<\/pre>\n<ul>\n<li>\u7136\u540e\u7528\u8fd9\u4e2a\u65b9\u5f0f\u4e0a\u4f20\u5305\uff1a<\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\">$ python setup.py sdist upload -r internal<\/pre>\n<h6>\u53c2\u8003\u94fe\u63a5\uff1a<\/h6>\n<ul>\n<li><a href=\"https:\/\/mengzhuo.org\/blog\/virtualenv%E5%92%8Cpip%E5%B0%8F%E6%8E%A2.html\" target=\"_blank\">Virtualenv\u548cpip\u5c0f\u63a2 | \u7b14\u8bb0\u672c<\/a><\/li>\n<li><a href=\"http:\/\/blog.chenming.info\/blog\/2012\/07\/08\/python-pip-virtualenv\/\" target=\"_blank\">Python\u7684virtualenv\u548cpip<\/a><\/li>\n<li><a href=\"http:\/\/topmanopensource.iteye.com\/blog\/2004853\" target=\"_blank\">\u4f7f\u7528\u56fd\u5185\u955c\u50cf\u6e90\u6765\u52a0\u901fpython pypi\u5305\u7684\u5b89\u88c5<\/a><\/li>\n<li><a href=\"https:\/\/pypi.python.org\/pypi\/pypiserver\" target=\"_blank\">pypiserver : Python Package Index<\/a><\/li>\n<li><a href=\"https:\/\/pip.pypa.io\/en\/latest\/user_guide.html#configuration\">https:\/\/pip.pypa.io\/en\/latest\/user_guide.html#configuration<\/a><\/li>\n<li><a href=\"https:\/\/docs.python.org\/2\/distutils\/packageindex.html\">https:\/\/docs.python.org\/2\/distutils\/packageindex.html <\/a>\u00a0#\u5b98\u65b9\u6587\u6863<\/li>\n<li><a href=\"http:\/\/simple-is-better.com\/news\/294\" target=\"_blank\">\u642d\u5efa\u79c1\u6709\u7684 python \u5305\u53d1\u5e03\u4e2d\u5fc3 pypi<\/a><\/li>\n<\/ul>\n<p>=<\/p>\n<h6>\u53e6\uff1a\u7528PIP\u66f4\u65b0\u6240\u6709\u5df2\u5b89\u88c5\u7684package<\/h6>\n<ul>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/2720014\/upgrading-all-packages-with-pip\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/2720014\/upgrading-all-packages-with-pip<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>PyPI &#8211; the Python Package Index &#8211; Python\u5305\u7d22\u5f15 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,6,12],"tags":[474],"class_list":["post-2001","post","type-post","status-publish","format-standard","hentry","category-linux","category-other","category-tools","tag-pip"],"views":24365,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=2001"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2001\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=2001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=2001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=2001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}