【问题标题】:Python Setup.py giving ModuleNotFoundErrorPython Setup.py 给出 ModuleNotFoundError
【发布时间】:2017-09-29 14:11:43
【问题描述】:

我一直在尝试使用这个库:latbin (https://pypi.python.org/pypi/latbin)

pip 没用 然后下载文件并使用:python setup.py install 更改了该文件夹中的当前目录(windows)

  C:\...\latbin-0.1.4.tar\dist\latbin>python setup.py install
Traceback (most recent call last):
  File "setup.py", line 5, in <module>
    import latbin
ModuleNotFoundError: No module named 'latbin'

目录结构使用与下载的相同。

顺便说一句,这是 setup.py 代码:

import os
os.chdir("C:/.../latbin-0.1.4.tar/dist/latbin/")
from distutils.core import setup
#from setuptools import setup, find_packages
import latbin

packages = ['latbin']
install_requires = ['numpy>=1.8','scipy>=0.14','pandas>=0.14']
ext_modules = []

setup(
    name='latbin',
    author="Tim Anderton, Dylan Gregersen",
    author_email='<quidditymaster@gmail.com>;<dylan.gregersen@utah.edu>',
    url="https://github.com/astrodsg/latbin",
    license="3-clause BSD style license",
    description="Python lattice binning package for large data",
    long_description=open("README.rst").read(),
    classifiers=["Development Status :: 3 - Alpha",
                 "Intended Audience :: Developers",
                 "Intended Audience :: Science/Research",
                 "License :: OSI Approved :: BSD License",
                 "Natural Language :: English",
                 "Programming Language :: Python",
                 "Topic :: Scientific/Engineering :: Mathematics",
                 "Topic :: Scientific/Engineering :: Physics"],
    platforms='any',
    version=latbin.__version__,
    #packages=find_packages(),
    packages=packages,
    ext_modules=ext_modules,
    install_requires=install_requires,
    )

【问题讨论】:

  • 看起来好像您没有完全提取 tarball。解压压缩包中的所有文件,然后在顶级目录中运行setup.py。您还可以告诉 pip 安装下载的 tarball。第一次尝试安装时pip 产生了什么错误信息?
  • 而对于后台:将当前脚本目录添加到Python路径中,因此可以直接导入与setup.py文件相同位置的latbin包。当然,前提是它在那里。
  • 您不能将 ram 重新定位到 ram(默认 dir = "/tmp"),请检查 @MartijnPieters cmets。
  • 您确定您下载了正确的文件吗?当我下载 latbin 文件时,setup.py 没有前两行。另外,你为什么不使用 pip?
  • 是的,我已经尝试过 PIP...同样的错误....我添加的行只是为了让事情在当前目录上工作....因为它没有得到我猜到的文件.

标签: python installation pip


【解决方案1】:

嗯,这不一定是这个问题的答案......但它在 Anaconda Distribution 中有效,之前我尝试使用 WinPython,但仍然无法正常工作。

终于找到正确答案了:

It was a bug

【讨论】:

    猜你喜欢
    • 2020-11-10
    • 1970-01-01
    • 1970-01-01
    • 2021-10-31
    • 1970-01-01
    • 2020-05-08
    • 1970-01-01
    • 1970-01-01
    • 2019-09-07
    相关资源
    最近更新 更多