ubuntu 下装feedparser

在Ubuntu系统中安装feedparser这个Python库时,首先需要下载并使用setuptools。通过wget下载feedparser的tar.gz文件,然后解压并进入目录,使用sudo python setup.py install进行安装,解决权限问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

==不能当自己是妹纸==

为了装Universal Feed Parser,先装了setuptools


下载

sudo wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e
解压
sudo tar zxvf setuptools-0.6c11.tar.gz
编译和安装
#wget https://bootstrap.pypa.io/ez_setup.py

然后莫名其妙保存了ez_setup.py

其实可以直接用... 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




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值