[英]Pip installs but module is not found
I am trying to install Exscript from github.我正在尝试从 github 安装 Exscript。
pip install -e 'git+git://github.com/knipknap/exscript.git#egg=Exscript'
...
Successfully installed Exscript
Cleaning up..
When i try to load it, python is not able to find it:当我尝试加载它时,python 无法找到它:
python2.7 -c "import Exscript"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named Exscript
But, when i try to install it in the same virtualenv with setup.py it installs and loads successfully.但是,当我尝试将它安装在与 setup.py 相同的 virtualenv 中时,它会成功安装并加载。
What am i doing wrong?我究竟做错了什么?
The flag -e
means "editable", and what happens behind the scenes is a symlink, and as I see, Exscript
uses a directory named src
, what is not seen a good practice[1].标志
-e
表示“可编辑”,幕后发生的是一个符号链接,正如我所见, Exscript
使用名为src
的目录,这不是一个好的做法[1]。
So, in order to solve your problem, you have two alternatives:因此,为了解决您的问题,您有两种选择:
-e
flag-e
标志src
, and use another directory namesrc
,并使用另一个目录名称Take a look at https://the-hitchhikers-guide-to-packaging.readthedocs.io/en/latest/creation.html#arranging-your-file-and-directory-structure and https://setuptools.readthedocs.io/en/latest/userguide/development_mode.html .看看https://the-hitchhikers-guide-to-packaging.readthedocs.io/en/latest/creation.html#arranging-your-file-and-directory-structure和https://setuptools.readthedocs。 io/en/latest/userguide/development_mode.html 。
[1]: the good practice is to have the directory as the same name as used when importing the package [1]:好的做法是使用与导入包时使用的名称相同的目录
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.