==不能当自己是妹纸==
为了装Universal Feed Parser,先装了setuptools
下载
sudo wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e其实可以直接用... sudo python ez_setup.py build
feedparse 是第三方python库,用来解析rss很方便,安装方法如下:
tinke@tinke-IdeaPad-Z485:~$ wget http://pypi.python.org/packages/source/f/feedparser/feedparser-5.1.3.tar.gz#md5=f2253de78085a1d5738f626fcc1d8f71
--2015-04-28 21:15:03-- http://pypi.python.org/packages/source/f/feedparser/feedparser-5.1.3.tar.gz
正在解析主机 pypi.python.org (pypi.python.org)... 103.245.222.223
正在连接 pypi.python.org (pypi.python.org)|103.245.222.223|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 301 Moved Permanently
位置:https://pypi.python.org/packages/source/f/feedparser/feedparser-5.1.3.tar.gz [跟随至新的 URL]
--2015-04-28 21:15:03-- https://pypi.python.org/packages/source/f/feedparser/feedparser-5.1.3.tar.gz
正在连接 pypi.python.org (pypi.python.org)|103.245.222.223|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 283614 (277K) [application/octet-stream]
正在保存至: “feedparser-5.1.3.tar.gz.1”
100%[======================================>] 283,614 30.5KB/s 用时 9.1s
2015-04-28 21:15:13 (30.5 KB/s) - 已保存 “feedparser-5.1.3.tar.gz.1” [283614/283614])
tinke@tinke-IdeaPad-Z485:~$ tar zxf feedparser-5.1.3.tar.gz
tinke@tinke-IdeaPad-Z485:~$ cd feedparser-5.1.3
进入feedparser-5.1.3
tinke@tinke-IdeaPad-Z485:~/feedparser-5.1.3$ ll
总用量 60
drwxrwxr-x 4 tinke tinke 4096 12月 10 2012 ./
drwxr-xr-x 26 tinke tinke 4096 4月 28 21:15 ../
drwxrwxr-x 3 tinke tinke 4096 12月 10 2012 docs/
drwxrwxr-x 4 tinke tinke 4096 12月 10 2012 feedparser/
-rw-rw-r-- 1 tinke tinke 3194 9月 23 2012 LICENSE
-rw-rw-r-- 1 tinke tinke 187 9月 23 2012 MANIFEST.in
-rw-rw-r-- 1 tinke tinke 20395 12月 10 2012 NEWS
-rw-rw-r-- 1 tinke tinke 1272 12月 10 2012 PKG-INFO
-rw-rw-r-- 1 tinke tinke 2503 9月 23 2012 README
-rw-rw-r-- 1 tinke tinke 59 12月 10 2012 setup.cfg
-rw-rw-r-- 1 tinke tinke 1530 12月 10 2012 setup.py
执行安装命令 $ python setup.py install 出现下面情况
tinke@tinke-IdeaPad-Z485:~/feedparser-5.1.3$ python setup.py install
running install
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/test-easy-install-25151.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python2.7/dist-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
https://pythonhosted.org/setuptools/easy_install.html
Please make the appropriate changes for your system and try again.
原因是安装目录出现了问题。
把 python setup.py install 改成 sudo python setup.py install 获取管理员权限,输入密码,就可以解决了
Installed /usr/local/lib/python2.7/dist-packages/feedparser-5.1.3-py2.7.egg
Processing dependencies for feedparser==5.1.3
Finished processing dependencies for feedparser==5.1.3