dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2160
  • 铜币13127枚
  • 威望5808点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
阅读:83回复:0

如何使用pip 安装 pyparted 包?

楼主#
更多 发布于:2018-09-18 13:37
问题描述
使用 pip 安装 pyparted 提示: Package libparted was not found in the pkg-config search path 。

sudo pip install pyparted
Downloading/unpacking pyparted
  Downloading pyparted-3.10.7.tar.gz (94kB): 94kB downloaded
  Running setup.py (path:/tmp/pip_build_root/pyparted/setup.py) egg_info for package pyparted
    Package libparted was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libparted.pc'
...省略

环境
Ubuntu Desktop 16.04

原因
因为 pyparted 编译过程中要调用 libparted 系统库,所以需要在系统中提前安装以下依赖包。
apt-get install libparted libparted0-dev

验证
sudo pip3 install pyparted
# 再次安装
Downloading/unpacking pyparted  Downloading pyparted-3.10.7.tar.gz (94kB): 94kB downloaded
  Running setup.py (path:/tmp/pip_build_root/pyparted/setup.py) egg_info for package pyparted

    warning: no files found matching 'BUGS'
Installing collected packages: pyparted
  Running setup.py install for pyparted
    building '_ped' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -DPYPARTED_VERSION="3.10.7" -Iinclude -I/usr/include/python3.4m -c src/pytimer.c -o build/temp.linux-x86_64-3.4/src/pytimer.o
...省略
Successfully installed pyparted
Cleaning up...

# 导入包
python3
Python 3.4.3 (default, Nov 28 2017, 16:41:13)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import parted

#
游客

返回顶部