无法安装python包gensim ubuntu

时间:2016-03-28 05:35:39

标签: python pip gensim ruamel.yaml

我无法通过

安装任何python包
$(document).ready(function() {
$('#Name').keyup(function(e) {
    var txtVal = $(this).val();
    txtVal = txtVal.toLowerCase();
    $('#URL').val(txtVal);
});

它总是抛出错误

pip install <name>

用于使用Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-V2srLa/Gensim Storing debug log for failure in /home/<username>/.pip/pip.log 的其他软件包,但不适用于gensim

我尝试过安装/解压缩软件包,然后sudo apt-get install python-<name>抛出python setup.py test python setup.py install

我试图安装&#39; ruamel.yaml&gt; = 0.10.7&#39;它仍然无法正常工作

为什么失败了?我该如何解决?

更新:转移到root(sudo su)为我工作

2 个答案:

答案 0 :(得分:0)

如果您使用系统 recommender = ProductRecommender.new products = current_user.products.select("id") @product_rec = (recommender.similarities_for("product-#{@product.id}")).map {|el| el.gsub(/(.*\-)[^\d]*/, "")} @products_rec_array = Product.find(@product_rec) @products_rec = Product.where(id: @products_rec_array).where.not(id: products) 安装pip,则您没有足够的权限可以写入ruamel.yaml。在这种情况下,使用sudo,或使用:

安装ruamel.yaml包
/usr/lib/python2.7/site-packages

(使用sudo apt-get install python-ruamel.yaml 会为您提供更新的版本)

答案 1 :(得分:0)

如果您偶然发现了这个问题,最好的答案是使用虚拟环境安装gensim和其他软件包,而不是使用sudo或root。参见Is it acceptable and safe to run pip install under sudo?https://towardsdatascience.com/all-you-need-to-know-about-python-virtual-environments-9b4aae690f9https://realpython.com/python-virtual-environments-a-primer/