Installing setuptools from source “No module named numbers” error

天大地大妈咪最大 提交于 2021-02-10 12:35:40

问题


This is based on Install Python Flask without using pip

My environment has no rpms installed or enabled, nor do I have pip, easy_install, virtualenv, etc.

Based on the answer in the linked question, I need to install setuptools in order to install Jinja.

To do this, I downloaded and un-tared setuptools-19.1.1.tar.gz. I then run the following command and get an ImportError:

$python setup.py install

 Traceback (most recent call last):
 File "setup.py", line 21, in <module>
 exec(init_file.read(), command_ns)
 File "<string>", line 11, in <module>
 File "/misc/scratch/flask-files/setuptools-19.1.1/setuptools/__init__.py", line 12, in <module>
 from setuptools.extension import Extension
 File "/misc/scratch/flask-files/setuptools-19.1.1/setuptools/extension.py", line 8, in <module>
 from .dist import _get_unpatched
 File "/misc/scratch/flask-files/setuptools-19.1.1/setuptools/dist.py", line 7, in <module>
 import numbers
ImportError: No module named numbers

Does anyone know where I can grab the numbers module? I can't find what that would be.

Thank you!


回答1:


I found the answer to my own question. Using an Ubuntu machine I entered my python terminal using

python -v

and tried import numbers:

>>> import numbers
# /usr/lib/python2.7/numbers.pyc matches /usr/lib/python2.7/numbers.py
import numbers # precompiled from /usr/lib/python2.7/numbers.pyc
# /usr/lib/python2.7/__future__.pyc matches /usr/lib/python2.7/__future__.py
import __future__ # precompiled from /usr/lib/python2.7/__future__.pyc

This showed me that the numbers module was located in /usr/lib/python2.7. In my current environment, I have nothing in my /usr/lib/python2.7/site-packages directory. So I scp-ed all of the files from my working Ubuntu enviroment to my empty server, so that I have the numbers module available (plus anything else I might need in the future).

Now running python setup.py install on my setuptools works.




回答2:


You can copy the source code from github to your local file /usr/lib/python3.5/numbers.py.



来源:https://stackoverflow.com/questions/34403297/installing-setuptools-from-source-no-module-named-numbers-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!