pypi 安装后 pip 安装上的 importerror
importerror on pip install after pypi install
参考:https://github.com/louking/loutilities/tree/0.14.7
我在 pip 安装此包后收到导入错误。当我使用easy_install 的鸡蛋时,一切都很好。任何有关如何调试的帮助将不胜感激。
使用以下命令将此包安装到 pypi,并使用 "pip 18.1 from c:\users\lking\anaconda2\lib\site-packages\pip (python 2.7)"
进行 pip 安装
python setup.py install
python setup.py sdist bdist_wheel
twine upload dist/loutilities-0.14.7.*
:
# later
pip install loutilities
当我运行这个项目,看下面
NoAppException: While importing "run", an ImportError was raised:
Traceback (most recent call last):
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\venv\lib\site-packages\flask\cli.py", line 235, in locate_app
__import__(module_name)
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\run.py", line 31, in <module>
app = create_app(Development(configpath), configpath)
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\contracts\__init__.py", line 82, in create_app
from contracts.views.frontend import bp as frontend
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\contracts\views\frontend\__init__.py", line 18, in <module>
import frontend
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\contracts\views\frontend\frontend.py", line 21, in <module>
from loutilities.flask_helpers.blueprints import add_url_rules
ImportError: No module named flask_helpers.blueprints
find_packages 似乎正在寻找合适的软件包:
from setuptools import find_packages
find_packages()
Out[4]: ['loutilities', 'tests', 'loutilities.flask_helpers']
setup.py:
#!/usr/bin/python
# [irrelevant comments deleted]
import glob
import pdb
# home grown
from loutilities import version
from setuptools import setup, find_packages
def globit(dir, filelist):
outfiles = []
for file in filelist:
filepath = '{0}/{1}'.format(dir,file)
gfilepath = glob.glob(filepath)
for i in range(len(gfilepath)):
f = gfilepath[i][len(dir)+1:]
gfilepath[i] = '{0}/{1}'.format(dir,f) # if on windows, need to replace backslash with frontslash
outfiles += [gfilepath[i]]
return (dir, outfiles)
setup(
name = "loutilities",
version = version.__version__,
packages = find_packages(),
# include_package_data = True,
scripts = [
'loutilities/agegrade.py',
'loutilities/apikey.py',
'loutilities/applytemplate.py',
'loutilities/filtercsv.py',
'loutilities/makerst.py',
],
# Project uses reStructuredText, so ensure that the docutils get
# installed or upgraded on the target machine
install_requires = [
'unicodecsv>=0.13.0',
],
# If any package contains any of these file types, include them:
data_files = ([
globit('loutilities', ['*.conf','*.pyc','*.pyd','*.dll','*.h','*.xlsx']),
globit('doc/source', ['*.txt', '*.rst', '*.html', '*.css', '*.js', '*.png', '*.py', ]),
globit('doc/build/html', ['*.txt', '*.rst', '*.html', '*.css', '*.js', '*.png', ]),
globit('doc/build/html/_sources', ['*.txt', '*.rst', '*.html', '*.css', '*.js', '*.png', ]),
globit('doc/build/html/_static', ['*.txt', '*.rst', '*.html', '*.css', '*.js', '*.png', ]),
globit('doc/build/html/_images', ['*.png', ]),
]),
entry_points = {
'console_scripts': [
'agegrade = loutilities.agegrade:main',
'apikey = loutilities.apikey:main',
'applytemplate = loutilities.applytemplate:main',
'filtercsv = loutilities.filtercsv:main',
'makerst = loutilities.makerst:main',
],
},
zip_safe = False,
# metadata for upload to PyPI
description = 'some hopefully useful utilities',
long_description=open("README.md").read(),
license = 'Apache License, Version 2.0',
author = 'Lou King',
author_email = 'lking@pobox.com',
url = 'http://github.com/louking/loutilities',
# could also include long_description, download_url, classifiers, etc.
)
在 pip install loutilities
之后,我在虚拟环境的 top-level 中看到一个未知目录 loutilities
。该目录包含一些 *.pyc
但不包含任何子目录。我怀疑 import loutilities.flask_helpers
试图找到一个子目录 loutilities/flask_helpers
但失败了。
我认为top-level目录来自代码
globit('loutilities', ['*.conf','*.pyc','*.pyd','*.dll','*.h','*.xlsx']),
我怀疑 globit()
中存在错误,将数据放在错误的目录中。
参考:https://github.com/louking/loutilities/tree/0.14.7
我在 pip 安装此包后收到导入错误。当我使用easy_install 的鸡蛋时,一切都很好。任何有关如何调试的帮助将不胜感激。
使用以下命令将此包安装到 pypi,并使用 "pip 18.1 from c:\users\lking\anaconda2\lib\site-packages\pip (python 2.7)"
进行 pip 安装python setup.py install
python setup.py sdist bdist_wheel
twine upload dist/loutilities-0.14.7.*
:
# later
pip install loutilities
当我运行这个项目,看下面
NoAppException: While importing "run", an ImportError was raised:
Traceback (most recent call last):
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\venv\lib\site-packages\flask\cli.py", line 235, in locate_app
__import__(module_name)
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\run.py", line 31, in <module>
app = create_app(Development(configpath), configpath)
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\contracts\__init__.py", line 82, in create_app
from contracts.views.frontend import bp as frontend
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\contracts\views\frontend\__init__.py", line 18, in <module>
import frontend
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\contracts\views\frontend\frontend.py", line 21, in <module>
from loutilities.flask_helpers.blueprints import add_url_rules
ImportError: No module named flask_helpers.blueprints
find_packages 似乎正在寻找合适的软件包:
from setuptools import find_packages
find_packages()
Out[4]: ['loutilities', 'tests', 'loutilities.flask_helpers']
setup.py:
#!/usr/bin/python
# [irrelevant comments deleted]
import glob
import pdb
# home grown
from loutilities import version
from setuptools import setup, find_packages
def globit(dir, filelist):
outfiles = []
for file in filelist:
filepath = '{0}/{1}'.format(dir,file)
gfilepath = glob.glob(filepath)
for i in range(len(gfilepath)):
f = gfilepath[i][len(dir)+1:]
gfilepath[i] = '{0}/{1}'.format(dir,f) # if on windows, need to replace backslash with frontslash
outfiles += [gfilepath[i]]
return (dir, outfiles)
setup(
name = "loutilities",
version = version.__version__,
packages = find_packages(),
# include_package_data = True,
scripts = [
'loutilities/agegrade.py',
'loutilities/apikey.py',
'loutilities/applytemplate.py',
'loutilities/filtercsv.py',
'loutilities/makerst.py',
],
# Project uses reStructuredText, so ensure that the docutils get
# installed or upgraded on the target machine
install_requires = [
'unicodecsv>=0.13.0',
],
# If any package contains any of these file types, include them:
data_files = ([
globit('loutilities', ['*.conf','*.pyc','*.pyd','*.dll','*.h','*.xlsx']),
globit('doc/source', ['*.txt', '*.rst', '*.html', '*.css', '*.js', '*.png', '*.py', ]),
globit('doc/build/html', ['*.txt', '*.rst', '*.html', '*.css', '*.js', '*.png', ]),
globit('doc/build/html/_sources', ['*.txt', '*.rst', '*.html', '*.css', '*.js', '*.png', ]),
globit('doc/build/html/_static', ['*.txt', '*.rst', '*.html', '*.css', '*.js', '*.png', ]),
globit('doc/build/html/_images', ['*.png', ]),
]),
entry_points = {
'console_scripts': [
'agegrade = loutilities.agegrade:main',
'apikey = loutilities.apikey:main',
'applytemplate = loutilities.applytemplate:main',
'filtercsv = loutilities.filtercsv:main',
'makerst = loutilities.makerst:main',
],
},
zip_safe = False,
# metadata for upload to PyPI
description = 'some hopefully useful utilities',
long_description=open("README.md").read(),
license = 'Apache License, Version 2.0',
author = 'Lou King',
author_email = 'lking@pobox.com',
url = 'http://github.com/louking/loutilities',
# could also include long_description, download_url, classifiers, etc.
)
在 pip install loutilities
之后,我在虚拟环境的 top-level 中看到一个未知目录 loutilities
。该目录包含一些 *.pyc
但不包含任何子目录。我怀疑 import loutilities.flask_helpers
试图找到一个子目录 loutilities/flask_helpers
但失败了。
我认为top-level目录来自代码
globit('loutilities', ['*.conf','*.pyc','*.pyd','*.dll','*.h','*.xlsx']),
我怀疑 globit()
中存在错误,将数据放在错误的目录中。