无法在conda环境中导入模块

时间:2018-06-22 19:50:20

标签: python pip setuptools conda

我有一个setup.py

#!/usr/bin/env python
from setuptools import setup

project = "classification-tools"
version = "0.0.2"

setup(
    name=project,
    version=version,
    install_requires=open('requirements.txt').readlines()
)

将安装我创建的一个小程序包。如您所见,我有一个顶级模块classification_tools

enter image description here

跑步时

(my-conda-env) $ python setup.py install
(my-conda-env) $ pip show classification-tools
Name: classification-tools
Version: 0.0.2
Summary: UNKNOWN
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Location: /home/stefan/miniconda3/envs/semeval2016/lib/python3.6/site-packages/classification_tools-0.0.2-py3.6.egg
Requires: numpy, scikit-learn, scipy, sklearn

但是,运行python并导入我刚刚安装的模块将导致ModuleNotFoundError,如您所见:

$ python
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import classification_tools
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'classification_tools'

我不明白这一点。我想念什么?

0 个答案:

没有答案