我正在嘗試安裝金字塔應用程序 - 比方說test_app
。在虛擬環境中,它被安裝爲test-app
(pip凍結輸出顯示它爲test-app==0.0
)。爲什麼PIP將下劃線轉換爲破折號
因此,我無法導入包。
我該如何解決這個問題?
更多信息: http://mail.python.org/pipermail/distutils-sig/2011-August/017935.html
我使用PIP版本1.3.1
setup.py:
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid',
'pyramid_debugtoolbar',
'waitress',
]
setup(name='test_app',
version='0.0',
description='test_app',
long_description=README + '\n\n' + CHANGES,
classifiers=[
"Programming Language :: Python",
"Framework :: Pyramid",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
],
author='',
author_email='',
url='',
keywords='web pyramid pylons',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=requires,
tests_require=requires,
test_suite="test_app",
entry_points="""\
[paste.app_factory]
main = test_app:main
""",
)
UPDATE:
總結的調查結果至今:
- pip將軟件包名稱報告爲test-app是正常的。
- 雞蛋鏈接指向你的虛擬env root是不正常的。
- 但是,.egg-info文件是在您的虛擬env根目錄中創建的,並指出將該目錄用作蛋根。
迄今爲止的總結:'develop'命令在虛擬env根目錄下創建一個'.egg-info'目錄,'.egg-link'文件指向同一個根目錄。這是導入錯誤的原因。 'pip'將軟件包名稱報告爲'test-app'的事實是正常的。 – 2013-05-05 17:24:44
@MartijnPieters我已經解決了這個問題。看到我的答案。 – treecoder 2013-05-05 19:36:54