{"id":3369,"date":"2019-05-30T14:09:50","date_gmt":"2019-05-30T06:09:50","guid":{"rendered":"https:\/\/damogame.cn\/wordpress\/?p=3369"},"modified":"2019-05-30T14:09:50","modified_gmt":"2019-05-30T06:09:50","slug":"centos6-9-youtube-dlffmpegbypy","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/3369","title":{"rendered":"CentOS6.9 youtube-dl+ffmpeg+bypy"},"content":{"rendered":"<div class=\"author\">\n<div class=\"info\">\n<div class=\"meta\"><a href=\"https:\/\/www.jianshu.com\/p\/e6a94899d1a6\">\u539f\u6587\u5730\u5740<\/a><\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"show-content\" data-note-content=\"\">\n<div class=\"show-content-free\">\n<h1>1.\u5148\u5b89\u88c5python2.7+<\/h1>\n<h4>\u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u4e2d\u7684 Python \u7248\u672c<\/h4>\n<pre class=\"hljs undefined\"><code>python --version\r\n<\/code><\/pre>\n<p>\u8fd4\u56de Python 2.6.6 \u4e3a\u6b63\u5e38\u3002<\/p>\n<h4>\u68c0\u67e5 CentOS \u7248\u672c<\/h4>\n<pre class=\"hljs undefined\"><code>cat \/etc\/redhat-release\r\n<\/code><\/pre>\n<p>\u8fd4\u56de CentOS release 6.9 (Final) \u4e3a\u6b63\u5e38\u3002<\/p>\n<h4>\u5b89\u88c5\u6240\u6709\u7684\u5f00\u53d1\u5de5\u5177\u5305<\/h4>\n<pre class=\"hljs bash\"><code class=\"bash\">yum groupinstall -y <span class=\"hljs-string\">\"Development tools\"<\/span>\r\n<\/code><\/pre>\n<h4>\u5b89\u88c5\u5176\u5b83\u7684\u5fc5\u9700\u5305<\/h4>\n<pre class=\"hljs undefined\"><code>yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel\r\n<\/code><\/pre>\n<h4>\u4e0b\u8f7d\u3001\u7f16\u8bd1\u548c\u5b89\u88c5 Python 2.7.13<\/h4>\n<pre class=\"hljs ruby\"><code class=\"ruby\">wget <span class=\"hljs-symbol\">https:<\/span>\/<span class=\"hljs-regexp\">\/www.python.org\/ftp<\/span><span class=\"hljs-regexp\">\/python\/<\/span><span class=\"hljs-number\">2.7<\/span>.<span class=\"hljs-number\">13<\/span>\/Python-<span class=\"hljs-number\">2.7<\/span>.<span class=\"hljs-number\">13<\/span>.tgz\r\ntar zxf Python-<span class=\"hljs-number\">2.7<\/span>.<span class=\"hljs-number\">13<\/span>.tgz\r\ncd Python-<span class=\"hljs-number\">2.7<\/span>.<span class=\"hljs-number\">13<\/span>\r\n.\/configure\r\nmake &amp;&amp; make install\r\n<\/code><\/pre>\n<h4>\u9ed8\u8ba4 Python 2.7.13 \u4f1a\u5b89\u88c5\u5728 \/usr\/local\/bin \u76ee\u5f55\u4e0b\u3002<\/h4>\n<pre class=\"hljs bash\"><code class=\"bash\">ll -tr \/usr\/<span class=\"hljs-built_in\">local<\/span>\/bin\/python*\r\n\r\n\/usr\/<span class=\"hljs-built_in\">local<\/span>\/bin\/python2.7\r\n\/usr\/<span class=\"hljs-built_in\">local<\/span>\/bin\/python2.7-config\r\n\/usr\/<span class=\"hljs-built_in\">local<\/span>\/bin\/python -&gt; python2\r\n\/usr\/<span class=\"hljs-built_in\">local<\/span>\/bin\/python2 -&gt; python2.7\r\n\/usr\/<span class=\"hljs-built_in\">local<\/span>\/bin\/python2-config -&gt; python2.7-config\r\n\/usr\/<span class=\"hljs-built_in\">local<\/span>\/bin\/python-config -&gt; python2-config\r\n<\/code><\/pre>\n<h4>\u800c\u7cfb\u7edf\u81ea\u5e26\u7684 Python \u662f\u5728 \/usr\/bin \u76ee\u5f55\u4e0b\u3002<\/h4>\n<pre class=\"hljs javascript\"><code class=\"javascript\">ll -tr \/usr\/bin\/python*\r\n\r\n<span class=\"hljs-regexp\">\/usr\/<\/span>bin\/python2<span class=\"hljs-number\">.6<\/span>-config\r\n\/usr\/bin\/python2<span class=\"hljs-number\">.6<\/span>\r\n\/usr\/bin\/python\r\n\/usr\/bin\/python2 -&gt; python\r\n\/usr\/bin\/python-config -&gt; python2<span class=\"hljs-number\">.6<\/span>-config\r\n<\/code><\/pre>\n<h4>\u66f4\u65b0\u7cfb\u7edf\u9ed8\u8ba4 Python \u7248\u672c<\/h4>\n<h4>\u5148\u628a\u7cfb\u7edf\u9ed8\u8ba4\u7684\u65e7\u7248 Python \u91cd\u547d\u540d\u3002<\/h4>\n<pre class=\"hljs undefined\"><code>mv \/usr\/bin\/python \/usr\/bin\/python.old\r\n<\/code><\/pre>\n<h4>\u518d\u5220\u9664\u7cfb\u7edf\u9ed8\u8ba4\u7684 python-config \u8f6f\u94fe\u63a5\u3002<\/h4>\n<pre class=\"hljs undefined\"><code>rm -f \/usr\/bin\/python-config\r\n<\/code><\/pre>\n<h4>\u6700\u540e\u521b\u5efa\u65b0\u7248\u672c\u7684 Python \u8f6f\u94fe\u63a5\u3002<\/h4>\n<pre class=\"hljs bash\"><code class=\"bash\">ln -s \/usr\/<span class=\"hljs-built_in\">local<\/span>\/bin\/python \/usr\/bin\/python\r\nln -s \/usr\/<span class=\"hljs-built_in\">local<\/span>\/bin\/python-config \/usr\/bin\/python-config\r\nln -s \/usr\/<span class=\"hljs-built_in\">local<\/span>\/include\/python2.7\/ \/usr\/include\/python2.7\r\n<\/code><\/pre>\n<h4>\u4ee5\u4e0a\u6b65\u9aa4\u505a\u5b8c\u4ee5\u540e\uff0c\u76ee\u5f55 \/usr\/bin \u4e0b\u7684 Python \u5e94\u8be5\u662f<\/h4>\n<pre class=\"hljs javascript\"><code class=\"javascript\">ll -tr \/usr\/bin\/python*\r\n\r\n<span class=\"hljs-regexp\">\/usr\/<\/span>bin\/python2<span class=\"hljs-number\">.6<\/span>-config\r\n\/usr\/bin\/python2<span class=\"hljs-number\">.6<\/span>\r\n\/usr\/bin\/python.old\r\n\/usr\/bin\/python2 -&gt; python\r\n\/usr\/bin\/python -&gt; <span class=\"hljs-regexp\">\/usr\/<\/span>local\/bin\/python\r\n\/usr\/bin\/python-config -&gt; <span class=\"hljs-regexp\">\/usr\/<\/span>local\/bin\/python-config\r\n<\/code><\/pre>\n<h4>\u67e5\u770b\u65b0\u7684 Python \u7248\u672c<\/h4>\n<pre class=\"hljs undefined\"><code>python --version\r\n<\/code><\/pre>\n<h4>\u8fd4\u56de Python 2.7.13 \u4e3a\u6b63\u5e38\u3002<\/h4>\n<h3>\u4ee5\u4e0b\u6b65\u9aa4\u8fd8\u662f\u6709\u5fc5\u8981\u7684<\/h3>\n<h4>\u4e3a\u65b0\u7248 Python \u5b89\u88c5 setuptools<\/h4>\n<pre class=\"hljs cpp\"><code class=\"cpp\">wget https:<span class=\"hljs-comment\">\/\/bootstrap.pypa.io\/ez_setup.py -O - | python<\/span>\r\n<\/code><\/pre>\n<p>setuptools \u6b63\u786e\u5b89\u88c5\u5b8c\u6210\u540e\uff0ceasy_install \u547d\u4ee4\u5c31\u4f1a\u88ab\u5b89\u88c5\u5728 \/usr\/local\/bin \u76ee\u5f55\u4e0b\u4e86\u3002<\/p>\n<h4>\u4e3a\u65b0\u7248 Python \u5b89\u88c5 pip<\/h4>\n<pre class=\"hljs undefined\"><code>easy_install pip\r\n<\/code><\/pre>\n<p>\u6b63\u786e\u5b89\u88c5\u5b8c\u6210\u540e\uff0cpip \u547d\u4ee4\u5c31\u4f1a\u88ab\u5b89\u88c5\u5728 \/usr\/local\/bin \u76ee\u5f55\u4e0b\u4e86\u3002<\/p>\n<h4>\u4e3a\u65b0\u7248 Python \u5b89\u88c5 distribute \u5305\uff08\u53ef\u9009\uff09<\/h4>\n<pre class=\"hljs undefined\"><code>pip install distribute\r\n<\/code><\/pre>\n<p>\u81f3\u6b64\uff0c\u65b0\u7248 Python \u5373\u7b97\u5b89\u88c5\u5b8c\u6bd5\u4e86\u3002<\/p>\n<p>\u6ce8\u610f\uff1a\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u4ee5\u524d\u5b89\u88c5\u8fc7\u7684 Python \u7a0b\u5e8f\u8fd0\u884c\u4e0d\u4e86\u6216\u8005\u65e0\u6cd5\u91cd\u542f\u4e4b\u7c7b\u7684\uff08\u6bd4\u5982\u8457\u540d\u7684 Shadowsocks Python \u7248\uff09\u3002\u539f\u56e0\u662f\u65e7\u7248\u7684 pkg_resources \u4f4d\u4e8e \/usr\/lib\/python2.6\/site-packages \u4e0b\u3002\u800c\u65b0\u7248\u7684\u5219\u662f\u5728 \/usr\/local\/lib\/python2.7\/site-packages \u4e0b\u3002<br \/>\n\u6240\u4ee5\uff0c\u4e5f\u8bb8\u4f60\u9700\u8981\u91cd\u65b0\u5b89\u88c5\u4e00\u4e0b\u7a0b\u5e8f\u3002<\/p>\n<p>\u518d\u6b21\u6ce8\u610f\uff1a\u5347\u7ea7 Python \u53ef\u80fd\u4f1a\u5bfc\u81f4 yum \u547d\u4ee4\u4e0d\u53ef\u7528\u3002\u89e3\u51b3\u65b9\u6cd5\u5982\u4e0b\uff1a<br \/>\n\u7f16\u8f91 \/usr\/bin\/yum \u6587\u4ef6\uff0c\u5c06\u5f00\u5934\u7b2c\u4e00\u884c\u7684<\/p>\n<pre class=\"hljs bash\"><code class=\"bash\"><span class=\"hljs-comment\">#!\/usr\/bin\/python<\/span>\r\n<\/code><\/pre>\n<p>\u6539\u4e3a<\/p>\n<pre class=\"hljs bash\"><code class=\"bash\"><span class=\"hljs-comment\">#!\/usr\/bin\/python2.6<\/span>\r\n<\/code><\/pre>\n<p>\u4f46\u662f\uff0c\u8fd9\u79cd\u6539\u6cd5\uff0c\u4e07\u4e00\u54ea\u5929\u4f60 yum update \u4e86\u4e00\u4e0b\uff0cyum \u88ab\u5347\u7ea7\u4e86\u540e\uff0c\u53c8\u53d8\u56de\u8001\u6837\u5b50\u4e86\u3002<\/p>\n<h1>2.youtube-dl\u5b89\u88c5<\/h1>\n<pre class=\"hljs undefined\"><code>yum install youtube-dl\r\n<\/code><\/pre>\n<h1>3.youtube\u8d44\u6e90\u662f\u97f3\u89c6\u9891\u5206\u79bb\uff0c\u7ee7\u7eed\u5b89\u88c5ffmpeg\u5408\u5e76\u97f3\u89c6\u9891<\/h1>\n<pre class=\"hljs ruby\"><code class=\"ruby\">rpm -ivh <span class=\"hljs-symbol\">https:<\/span>\/<span class=\"hljs-regexp\">\/www.mirrorservice.org\/sites<\/span><span class=\"hljs-regexp\">\/dl.atrpms.net\/el<\/span>7-x86_64\/atrpms\/stable\/atrpms-repo-<span class=\"hljs-number\">7<\/span>-<span class=\"hljs-number\">7<\/span>.el7.x86_64.rpm\r\nvi \/etc\/yum.repos.d\/atrpms.repo\r\n<\/code><\/pre>\n<p>\u66ff\u6362[atrpms]\u4e0bbaseURL,enabled=1\u6539\u4e3a0<\/p>\n<pre class=\"hljs ruby\"><code class=\"ruby\">baseurl=<span class=\"hljs-symbol\">https:<\/span>\/<span class=\"hljs-regexp\">\/www.mirrorservice.org\/sites<\/span><span class=\"hljs-regexp\">\/dl.atrpms.net\/el<\/span>$releasever-$basearch\/atrpms\/stable\r\nenabled=<span class=\"hljs-number\">0<\/span>\r\n<\/code><\/pre>\n<pre class=\"hljs undefined\"><code>yum -y --enablerepo=atrpms install ffmpeg\r\n<\/code><\/pre>\n<h1>4.\u5b89\u88c5byby\uff0c \u9700\u8981python2.7+<\/h1>\n<pre class=\"hljs undefined\"><code>pip install bypy\r\n<\/code><\/pre>\n<p>\u5982\u4f55\u4f7f\u7528\uff0c\u53c2\u8003<a href=\"https:\/\/link.jianshu.com\/?t=https%3A%2F%2Fgithub.com%2Fhoutianze%2Fbypy\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https:\/\/github.com\/houtianze\/bypy<\/a><\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u5730\u5740 1.\u5148\u5b89\u88c5python2.7+<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[],"tags":[117],"class_list":["post-3369","post","type-post","status-publish","format-standard","hentry","tag-01-linux"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/3369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=3369"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/3369\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=3369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=3369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=3369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}