我正在尝试使用
安装gensimsudo -H pip install --upgrade gensim
但它给了我这个错误:
File "setup.py", line 301, in <module>
include_package_data=True,
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/local/lib/python2.7/dist-packages/setuptools/command /install.py", line 67, in run
self.do_egg_install()
File "/usr/local/lib/python2.7/dist-packages/setuptools/command /install.py", line 98, in do_egg_install
easy_install = self.distribution.get_command_class('easy_install')
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 576, in get_command_class
self.cmdclass[command] = cmdclass = ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2229, in load
return self.resolve()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 47, in <module>
from setuptools.sandbox import run_setup
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 15, in <module>
import pkg_resources.py31compat
ImportError: No module named py31compat
请帮我安装gensim。我用Google搜索,但我无法找到解决方案。
答案 0 :(得分:0)
看起来缺少setuptoopls。尝试
> conflicts(detail = T)
$.GlobalEnv
[1] "n" "df" "dt" "gamma" "t"
$`package:stringr`
[1] "%>%"
$`package:data.table`
[1] "between" "first" "last"
$`package:dplyr`
[1] "%>%" "between" "first" "last" "n" "filter" "lag"
[8] "intersect" "setdiff" "setequal" "union"
$`package:ggplot2`
[1] "Position"
$`package:stats`
[1] "df" "dt" "filter" "lag"
$`package:methods`
[1] "body<-" "kronecker"
$`package:base`
[1] "body<-" "gamma" "intersect" "kronecker" "Position" "setdiff" "setequal"
[8] "t" "union"
答案 1 :(得分:0)
请注意setuptools
来自/usr/local/lib
而pkg_resources
来自/usr/lib
。您必须通过软件包系统拥有较旧的pkg_resources,然后通过pip安装较新的setuptools。
删除(或移开)/usr/local/lib/python2.7/dist-packages/setuptools
目录。
答案 2 :(得分:0)
我在Ansible运行重构的OpenShift剧本时遇到了类似的错误。解析完所有游戏后发现错误。
&#34; ERROR!意外的异常,这可能是一个错误:无法导入名称py31compat&#34;
我正在使用......
我运行以下命令列出与Python 2相关的所有软件包和库的位置。我检查了可用的路径,以确保我有一个版本的Ansible和每个软件包的一个副本安装。
$ python -c&#39; import sys; print sys.path&#39;
&#39; py31compat&#39;不是一个可以下载的单独模块。它包含在Setuptools包中。我确定我安装了两个不同版本的软件包,都是过时的。我通过pip卸载了两个版本并安装了最新的setuptools版本。没运气。
我的解决方案是卸载Ansible并重新安装相同的版本。这解决了这个问题。
答案 3 :(得分:0)
就我而言,我已经安装了odoo v10,并且出于任何奇怪的原因而更新或安装了卡住我的服务器且不再使用XOE开头的库。
错误是:
无法导入名称py31compat
1小时后,我尝试了许多不同的事情,我决定将其卸载:
sudo pip uninstall setuptools
Uninstalling setuptools-40.8.0: Would remove: /usr/local/bin/easy_install /usr/local/bin/easy_install-2.7 /usr/local/lib/python2.7/dist-packages/easy_install.py /usr/local/lib/python2.7/dist-packages/pkg_resources/* /usr/local/lib/python2.7/dist-packages/setuptools-40.8.0.dist-info/**
我的服务odoo服务器启动并再次正常工作!