简体   繁体   English

安装后无法导入模块

[英]Cannot import module after install

I have installed a python application with the command python setup.py install from the project folder, but when I execute it from my bash I get the error: 我已经从项目文件夹中使用命令python setup.py install安装了python应用程序,但是当我从bash执行它时,出现错误:

ImportError No module named 'skipgram' ImportError没有名为“ skipgram”的模块

This module is imported directly from the __main__.py file. 该模块直接从__main__.py文件导入。 The project source is https://github.com/phanein/deepwalk . 该项目的来源是https://github.com/phanein/deepwalk You can see that in the deepwalk folder there is the file __main__.py , and from there, it imports the Skipgram library. 您可以看到在deepwalk文件夹中有文件__main__.py ,并从那里导入Skipgram库。 I am a newbie in python programming, maybe this is a problem concerning some path variable? 我是python编程的新手,也许这是有关某些路径变量的问题?

PS. PS。 My actual setup is: Python 3.5 on anaconda3 on Linux Mint 18. 我的实际设置是:Linux Mint 18上anaconda3上的Python 3.5。

I agree with @erotemic, it seems that line 16 in main .py should be changed to: 我同意@erotemic,似乎应该将 .py中的第16行更改为:

from deepwalk.skipgram import Skipgram

you can see a discrepancy in the imports when you note that graph.py and walks.py are in the same folder as skipgram.py, yet graph and walks are imported like this: 当您注意到graph.py和walks.py与skipgram.py在同一文件夹中时,您会看到导入中的差异,而graph和walks的导入方式如下:

from deepwalk import graph
from deepwalk import walks as serialized_walks

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM