Linux离线安装fasttext库

项目场景:

我想在不能联网的Linux服务器上部署 fasttext。

问题描述:

按照官方的步骤【传送门】,当时报错如下,这个错误就是联网连不上。
在这里插入图片描述

解决方案:

解决思路就是找到安装 fasttext 所需要的依赖,然后把依赖和fasttext一起复制到没有网的机器上。

所以你需要有一台可以联网且与服务器一样系统的电脑。

  1. 在有网的机器上使用pip install fasttext,你可以看到类似如下输出,证明你安装成功。可以看到 fasttext依赖两个库:pybind11 和 setuptools。
Looking in indexes: https://mirrors.aliyun.com/pypi/simple
Processing /root/fastText
  DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directoryend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.
   pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issu
Requirement already satisfied: pybind11>=2.2 in /root/miniconda3/envs/test/lib/python3.7/site-packages (from fasttext==0.9.2) (2.6
Requirement already satisfied: setuptools>=0.7.0 in /root/miniconda3/envs/test/lib/python3.7/site-packages (from fasttext==0.9.2) t20210108)
Requirement already satisfied: numpy in /root/miniconda3/envs/test/lib/python3.7/site-packages (from fasttext==0.9.2) (1.20.3)
Building wheels for collected packages: fasttext
  Building wheel for fasttext (setup.py) ... |                                                                                    one
  Created wheel for fasttext: filename=fasttext-0.9.2-cp37-cp37m-linux_x86_64.whl size=2714662 sha256=c164e256ecdc13a6606329697db25ec2e384965692d77e566b287
  Stored in directory: /tmp/pip-ephem-wheel-cache-95x5jren/wheels/a7/e0/d1/9d529395c6898715bf3abbf89f1c41833e0a555a741df47cb9
Successfully built fasttext
Installing collected packages: fasttext
Successfully installed fasttext-0.9.2
WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.nings/venv
  1. 去包安装的位置将这三个库对应的文件夹以及一个文件下载下来,如果不会下载可评论。
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
  2. 然后将这些文件上传到你的没有网的服务器的环境下,即可使用;需要注意,如果你有conda虚拟环境,看看里面是否有setuptools库,如果有,就不用再复制这个文件夹了。

注:
该思路也可以拓展到其他想要pip离线安装的库上。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值