简体   繁体   中英

error install my package python using pip

I have some problem in installing the package in python.

I made a python package itself like this

def joke():
    return ('test')

and save it with the name __init__.py then I upload to pypi and I have the massage that:

Submitting dist/funni3st-0.2.tar.gz to https://pypi.python.org/pypi
Server response (200): OK

then I tried to install the package using pip

sudo pip install funni3st

Collecting funni3st
  Downloading funni3st-0.2.tar.gz
Installing collected packages: funni3st
  Running setup.py install for funni3st ... done
Successfully installed funni3st-0.2

I tried to run this package in spyder python, I have the massage

import funni3st
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named funni3st

anyone can help me what's wrong with my python module?

Thank you

import funniest

This should work. It seems that packaged with a wrong name.

$ pip2 install funni3st
Requirement already satisfied: funni3st in /usr/local/lib/python2.7/site-packages

Looks like you named it funniest

$ cat /usr/local/lib/python2.7/site-packages/funniest/__init__.py

def joke():
    return (u'Wenn ist das Nunst\u00fcck git und Slotermeyer? Ja! ... '
            u'Beiherhund das Oder die Flipperwaldt gersput.')

And works fine, by the way

In [1]: import funniest

In [2]: funniest.joke()
Out[2]: u'Wenn ist das Nunst\xfcck git und Slotermeyer? Ja! ... Beiherhund das Oder die Flipperwaldt gersput.'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM