pip 安装python-iptables报错 /bin/ld: cannot find -lpython3.6m

pip 安装python-iptables报错 /bin/ld: cannot find -lpython3.6m

报错日志

# pip3 install --upgrade python-iptables
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting python-iptables
  Using cached https://files.pythonhosted.org/packages/35/e4/33e639b9e153c2d798d73342a96715a4edca6f46431d763b275a34b3aeca/python-iptables-1.0.1.tar.gz
Installing collected packages: python-iptables
  Running setup.py install for python-iptables ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-2qvrmx9k/python-iptables/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-mym_dl_9-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/iptc
    copying iptc/__init__.py -> build/lib.linux-x86_64-3.6/iptc
    copying iptc/easy.py -> build/lib.linux-x86_64-3.6/iptc
    copying iptc/errors.py -> build/lib.linux-x86_64-3.6/iptc
    copying iptc/ip4tc.py -> build/lib.linux-x86_64-3.6/iptc
    copying iptc/ip6tc.py -> build/lib.linux-x86_64-3.6/iptc
    copying iptc/util.py -> build/lib.linux-x86_64-3.6/iptc
    copying iptc/version.py -> build/lib.linux-x86_64-3.6/iptc
    copying iptc/xtables.py -> build/lib.linux-x86_64-3.6/iptc
    running build_ext
    building 'libxtwrapper' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/libxtwrapper
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.6m -c libxtwrapper/wrapper.c -o build/temp.linux-x86_64-3.6/libxtwrapper/wrapper.o
    gcc -pthread -shared -Wl,-z,relro -g build/temp.linux-x86_64-3.6/libxtwrapper/wrapper.o -L/usr/lib64 -lpython3.6m -o build/lib.linux-x86_64-3.6/libxtwrapper.cpython-36m-x86_64-linux-gnu.so
    /bin/ld: cannot find -lpython3.6m
    collect2: error: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1

解决办法

可以看到引用动态链接库 /usr/lib64/python3.6m 失败,查看/usr/lib64/发现有一个/usr/lib64/libpython3.6m.so.1.0

# ll /usr/lib64/libpython3.6m*
-rwxr-xr-x. 1 root root 3144192 Nov 17  2020 /usr/lib64/libpython3.6m.so.1.0

设置软连接

# ln -s /usr/lib64/libpython3.6m.so.1.0 /usr/lib64/libpython3.6m

再次安装成功

# pip3 install --upgrade python-iptables
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting python-iptables
  Using cached https://files.pythonhosted.org/packages/35/e4/33e639b9e153c2d798d73342a96715a4edca6f46431d763b275a34b3aeca/python-iptables-1.0.1.tar.gz
Installing collected packages: python-iptables
  Running setup.py install for python-iptables ... done
Successfully installed python-iptables-1.0.1
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值