0
嗨!virtualenv找不到包 - 沒有名爲「mypack」的模塊
我試過在我的主程序(名爲collector
)上使用我創建的包(名爲mypackage
)。 mypackage
定義與下面的setup.py
:
name = "mypackage"
[...]
packages = find_packages(),
include_package_data = True,
exclude_package_data = { '': ['README.md'] }
[...]
entry_points = {
'console_scripts': [
'my-package=mypack.mypack:main'
]
},
我想用一個小程序提出這個包,這通常會被如下呼籲collector
:
from mypack.common.prog import mylittleprogram
我試圖安裝mypackage
在virtualenv上,然後(重新)安裝我的主程序。然後我執行它,並有我有錯誤:
Traceback (most recent call last):
from project.common.collector import collectArt
File "/root/project/lib/python3.5/site-packages/collector-0.1-py3.5.egg/project/common/collector.py", line 7, in <module>
ImportError: No module named 'mypack'
此外,當virtualenv中被激活,我只是試着推出名爲my-package
入口點:
Traceback (most recent call last):
File "/root/project/bin/my-package", line 11, in <module>
load_entry_point('mypackage==0.1.1', 'console_scripts', 'my-package')()
File "/root/project/lib/python3.5/site-packages/pkg_resources/__init__.py", line 560, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/root/project/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2648, in load_entry_point
return ep.load()
File "/root/project/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2302, in load
return self.resolve()
File "/root/project/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2308, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named 'mypack'
注1:我確切地說我的包裝上的每個文件夾都有__init__.py
。
注意2:virtualenv
文件夾與我的主程序位於同一文件夾中。
如何使用mylittleprogram
我的collector
主程序中有virtualenv
?我做錯了什麼?
謝謝:)