Exception you need a c compiler to build uwsgi windows

I got an error,Failed building wheel for uwsgi. My environment is Ubuntu,now I wanna install uwsgi,so I run command pip install uwsgi.But error happens Traceback (most recent call last): ...

I got an error,Failed building wheel for uwsgi.
My environment is Ubuntu,now I wanna install uwsgi,so I run command pip install uwsgi.But error happens

 Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-9t06jm4_/uwsgi/setup.py", line 126, in <module>
      distclass=uWSGIDistribution,
    File "/home/ubuntu/anaconda3/lib/python3.5/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/wheel/bdist_wheel.py", line 215, in run
      self.run_command('install')
    File "/home/ubuntu/anaconda3/lib/python3.5/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-9t06jm4_/uwsgi/setup.py", line 77, in run
      conf = uc.uConf(get_profile())
    File "/tmp/pip-build-9t06jm4_/uwsgi/uwsgiconfig.py", line 742, in __init__
      raise Exception("you need a C compiler to build uWSGI")
  Exception: you need a C compiler to build uWSGI

  ----------------------------------------
  Failed building wheel for uwsgi
  Running setup.py clean for uwsgi
Failed to build uwsgi
Installing collected packages: uwsgi
  Running setup.py install for uwsgi ... error
    Complete output from command /home/ubuntu/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9t06jm4_/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-oxbyg6gk-record/install-record.txt --single-version-externally-managed --compile:
    /home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'descriptions'
      warnings.warn(msg)
    running install
    using profile: buildconf/default.ini
    detected include path: ['/usr/include', '/usr/local/include']
    Traceback (most recent call last):
      File "/tmp/pip-build-9t06jm4_/uwsgi/uwsgiconfig.py", line 734, in __init__
        gcc_version_components = gcc_version.split('.')
    AttributeError: 'NoneType' object has no attribute 'split'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-9t06jm4_/uwsgi/setup.py", line 126, in <module>
        distclass=uWSGIDistribution,
      File "/home/ubuntu/anaconda3/lib/python3.5/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-9t06jm4_/uwsgi/setup.py", line 77, in run
        conf = uc.uConf(get_profile())
      File "/tmp/pip-build-9t06jm4_/uwsgi/uwsgiconfig.py", line 742, in __init__
        raise Exception("you need a C compiler to build uWSGI")
    Exception: you need a C compiler to build uWSGI

    ----------------------------------------
Command "/home/ubuntu/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9t06jm4_/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-oxbyg6gk-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-9t06jm4_/uwsgi/

I run command sudo apt-get -y install python-dev,but same error happens.I really cannot understand why these error happens.How should I fix this?Why am I told I need C compiler in uWSGI?How should I fix this?

Tip: Please don’t try it like me, waste time, go play on Linux!

A few hours of installation experience

Yesterday afternoon, I learned to deploy the «Django project to the Nginx server». This deployment requires an Nginx server in addition to the Nginx server.

Protocol software for communication — uwsgi.

However, after trying, I finally failed to install uwsgi to Windows 10, and some bloggers said that uwsgi does not support Windows 10

Install, that is, no! However, the blog posts of the official website and netizens have shown that Cygwin can be installed on Windows and then installed in the Cygwin environment.

I thought that there is no need to continue to install software such as uwsgi on Cygwin, install a Linux operating system (Ubuntu?) directly, and then try again.

The test is the best, after all, the final Django project is to be deployed to Linux or UNIX.

Errors during installation

1.pip installation

Traceback shows that the line 8 in uwsgiconfig.py calls os.uname()[0] to find the error:

AttributeError: module ‘os‘ has no attribute ‘uname‘

Import the os module in IDLE and check it with the dir(os) command. It does not find that there is a uname attribute under it (the following is a partial screenshot):

2.python3 setup.py install installation (uwsgi offline package)

After you can’t directly install the pip command, you can try to download the module’s offline installation package and then manually download it.

Comments: Pip can not be installed successfully, in addition to the reason not found, download offline installation package can be successfully installed? Express doubts~

It can be downloaded from the pypi.org website, uwsgi’s Github homepage. The following image is a screenshot of the uwsgi download page of the pypi.org website:

Use 7-zip to extract to the current directory, get a uwsgi-2.0.17.tar, extract the tar file, get the uwsgi-2.0.17 folder, and then you can

The folder is installed uwsgi.

Put the uwsgi folder in the right place (there is a blog post that says Python’s lib/site-packages, when I don’t think it’s necessary, just put the C drive).

Next, use the command line to enter the uwsgi directory — there is a setup.py file to install uwsgi, execute the python3 setup.py install command, and

If the uname error still exists.

I don’t know what to do, I entered the error in Baidu and got the answer — in the reference materialWindow installation uwsgi encountered uname perfect solution, that is, open

Modify the uwsgiconfig.py file:

— Import the platform module

— Replace os.uname with platform.uname (four in total)

Execute the python3 setup.py install command again, and the result is still wrong! This tip:

Exception: you need a C compiler to build uWSGI

Need a C compiler, but not in the environment at this time!

After a web search, you can install a Cygwin to solve this problem. Ok, install Cygwin.

What is Cygwin?From my experience, I simulated a Linux operating environment on Windows, see the official website.

Install Cygwin: First select a Japanese mirror, the result of the installation failed; later selected the only HK image (red box below), the installation was successful.

Successful installation:

GCC also has! (This is the C compiler we need, in fact, don’t explain it?)

Next, add the compiler commands from Cygwin to the Windows environment variable Path:

Executing the python3 setup.py install command again on the Windows command line fails, prompting for two errors:

UWSGI_EVENT_IN、UWSGI_EVENT_OUT

So, execute the python3 setup.py install command in Cygwin? The result is still a failure!

At this point, there is no way to move!

The network searches for UWSGI_EVENT_IN, UWSGI_EVENT_OUT related information, and finally finds that these two macro definitions appear in uwsgi’s core/event.c source file:

At first glance, continue the web search, Chinese and English — mainly stackoverflow, but there is no solution, and some blog posts

Directly, it does not support installing uwsgi on Windows!

Maybe it will be a while, but such a big news will not be missed by a Python programmer, right?

Give up this road! Go and install Ubuntu! Go to Django+Nginx+uwsgi on Ubuntu!

P.S.

However, why is this happening? What is poll (when I learned it many years ago, later, I forgot)?

About the information of poll, continue to search online!

Author: Ben.Z

Baidu Encyclopedia’s poll()

I can’t publish Django programs on Windows, but I can still test and practice Django programs on Windows.

You can also learn the configuration of Nginx+uwsgi by viewing the blog post.

So, can Django programs developed on Windows be easily ported to Linux?

It seems that you still have to learn Linux well!

Reference materials:

Uwsgi official website

Django Nginx+uwsgi installation configuration (novice tutorial)
uWSGI detailed explanation
Windows python installation uwsgi (2018-02-28)
Windows 7 deploys django project using nginx+apache

Window installation uwsgi encountered uname perfect solution

Windows 10 installation uWSGI: not feasible, failed

label:installation   technology sharing   blog   by   get   dir   Homepage   compiler   position   

Original address: https://www.cnblogs.com/luo630/p/9031756.html

I get the following error:

~$ sudo apt install build-essential python2.7-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.4ubuntu1).
python2.7-dev is already the newest version (2.7.15-4ubuntu4~18.04.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
~$ which gcc
/usr/bin/gcc
~$ gcc
gcc: fatal error: no input files
compilation terminated.
~$ pip install uwsgi==1.9.20 --index-url=http://192.168.1.200/pypackages/simple/ --trusted-host 192.168.1.200
Collecting uwsgi==1.9.20
  Downloading http://192.168.1.200/pypackages/simple/uwsgi/uwsgi-1.9.20.tar.gz (731kB)
    100% |████████████████████████████████| 737kB 12.1MB/s 
Building wheels for collected packages: uwsgi
  Running setup.py bdist_wheel for uwsgi ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-u0AKpd/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp63xyFzpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  copying uwsgidecorators.py -> build/lib.linux-x86_64-2.7
  installing to build/bdist.linux-x86_64/wheel
  running install
  using profile: buildconf/default.ini
  detected include path: ['/usr/lib/gcc/x86_64-linux-gnu/7/include', '/usr/local/include', '/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed', '/usr/include/x86_64-linux-gnu', '/usr/include']
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-u0AKpd/uwsgi/setup.py", line 109, in <module>
      distclass=uWSGIDistribution,
    File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 129, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
      dist.run_commands()
    File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/usr/lib/python2.7/dist-packages/wheel/bdist_wheel.py", line 240, in run
      self.run_command('install')
    File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-u0AKpd/uwsgi/setup.py", line 71, in run
      conf = uc.uConf(get_profile())
    File "uwsgiconfig.py", line 627, in __init__
      raise Exception("you need a C compiler to build uWSGI")
  Exception: you need a C compiler to build uWSGI

The error says I do not have a C compiler but gcc is installed.

Совет: пожалуйста, не пытайтесь, как я, теряйте время, переходите на Linux!

Несколько часов опыта установки

Вчера днем ​​я научился развертывать «Проект Django на сервере Nginx». Для этого развертывания требуется сервер Nginx в дополнение к серверу Nginx.

Протокол программного обеспечения для связи.

Однако, после попытки, в конечном итоге не удалось установить UWSGI для Windows 10, и в блоге от пользователей сети говорится, что UWSGI не поддерживает установку на Windows 10.

Притворяться, т. Е. Нет! Тем не менее, как официальный сайт, так и сообщения в блоге пользователей сети указывают, что Cygwin можно установить в Windows, а затем установить в среде Cygwin.

Я думал, что нет необходимости продолжать пытаться установить программное обеспечение, такое как uwsgi, на Cygwin, установить операционную систему Linux (Ubuntu?) Напрямую, а затем попробовать

В конце концов, лучше всего попробовать окончательный проект Django — развернуть его под Linux или UNIX.

Ошибки при установке

Установка 1.pip

Трассировка показывает, что строка 8 файла uwsgiconfig.py вызывает os.uname () [0] и находит ошибку:

AttributeError: module ‘os‘ has no attribute ‘uname‘

Импортируйте модуль os в IDLE и используйте для проверки команду dir (os), которая не нашла атрибут uname (ниже скриншот):

2.python3 setup.py установить установку (автономный пакет uwsgi)

После того, как вы не можете напрямую выполнить успешную установку с помощью команды pip, вы можете попробовать загрузить автономный установочный пакет модуля, а затем загрузить его вручную.

Комментарий: Pip не может быть успешно установлен. За исключением причин, которые не могут быть найдены, могу ли я успешно загрузить автономный установочный пакет? Выразить сомнение ~

Его можно загрузить с веб-сайта pypi.org и с домашней страницы uwsgi Github. На следующем рисунке показан снимок экрана со страницей загрузки uwsgi на сайте pypi.org:

Используйте 7-zip, чтобы распаковать в текущий каталог, чтобы получить uwsgi-2.0.17.tar, затем распакуйте файл tar, чтобы получить папку uwsgi-2.0.17, и тогда вы можете основываться на этом

Uwsgi устанавливается в папку.

Затем поместите папку uwsgi в соответствующее место (в сообщении блога говорится, что оно помещено в lib / site-packages Python, когда я не думаю, что это необходимо, просто вставьте его в диск C).

Далее, используйте командную строку для входа в каталог uwsgi — для установки uwsgi есть файл setup.py и выполните команду python3 setup.py install для завершения

В результате ошибка uname сохраняется.

Я не знаю, что делать. Я ввел ошибку в Baidu и получил ответ — в ссылкеустановка windows uwsgi встречается uname отлично решена, Который открывается

Файл uwsgiconfig.py для изменения:

-Импорт модуль платформы

-Замените platform.uname на os.uname (всего четыре)

Выполните команду установки python3 setup.py еще раз, в результате по-прежнему возникает ошибка! На этот раз:

Exception: you need a C compiler to build uWSGI

Компилятор C необходим, но не в этой среде!

После веб-поиска вы можете установить Cygwin для решения этой проблемы. Хорошо, установите Cygwin.

Что такое Cygwin?По моему опыту, это симуляция операционной среды Linux на Windows. Для получения дополнительной информации см. Официальный сайт.

Установите Cygwin: сначала выбрано японское зеркало (зеркало), но установка не удалась, позже я выбрал единственное зеркало HK (красная коробка ниже), и установка прошла успешно.

Установка прошла успешно:

GCC здесь тоже! (Нам нужен компилятор Си. На самом деле, вам не нужно объяснять?)

Затем добавьте команду компилятора в Cygwin в переменную среды Windows Path:

Снова выполните команду установки python3 setup.py в командной строке Windows, которая завершается с двумя ошибками:

UWSGI_EVENT_IN、UWSGI_EVENT_OUT

Итак, как насчет выполнения команды установки python3 setup.py в Cygwin? Это все еще не удалось!

На данный момент, почти нет трюк!

После поиска информации, связанной с UWSGI_EVENT_IN и UWSGI_EVENT_OUT, я обнаружил, что эти два определения макросов появились в исходном файле core / event.c файла uwsgi:

На первый взгляд, продолжайте поиск в Интернете, китайский, английский — в основном, stackoverflow, но пока нет решения, и некоторые сообщения в блоге.

Прямо говоря, установка uwsgi в Windows не поддерживается!

Может быть, это будет какое-то время, но такие замечательные новости не должны быть пропущены программистом Python, верно?

Оставь эту дорогу! Идите и установите Ubuntu! Иди в Ubuntu и играй с Django + Nginx + uwsgi!

P.S.

Но почему это происходит? Что такое опрос (я знал об этом много лет назад, а потом забыл)?

По поводу опроса информации, продолжайте поиск в интернете!

Автор: Ben.Z

Опрос () из энциклопедии Baidu

Публикация программ Django в Windows невозможна, но вы все равно можете протестировать и попрактиковаться в разработке программ Django в Windows.

Вы также можете узнать конфигурацию Nginx + uwsgi, просмотрев сообщение в блоге.

Итак, могут ли программы Django, разработанные для Windows, быть легко перенесены на Linux?

Похоже, нам еще нужно хорошо выучить Linux!

Ссылки:

UWSGI официальный сайт

Конфигурация установки Django Nginx + uwsgi (учебник для новичков)
uWSGI Подробно
Установите UWSGI под Windows Python (2018-02-28)
Windows 7 использует nginx + apache для развертывания проекта django

установка windows uwsgi встречается uname отлично решена

Установка uWSGI в Windows 10: невозможно и не удалось

Метки:устанавливать   Обмен технологиями   blog   по   get   dir   дома   compiler   расположение   

Оригинальный адрес: https://www.cnblogs.com/luo630/p/9031756.html

I am trying to install uwsgi along with other pypy packages using a requirements.txt file. I am able to install everything except uwsgi. Its giving me the following error:

# requirements.txt
Flask == 0.12
uwsgi == 2.0.14
requests == 2.13.0
redis == 2.10.5
#Dockerfile
FROM python:3.4-alpine

RUN apk add --update --no-cache 
		pcre-dev 
# 		build-base 
#		python3-dev

RUN addgroup -S uwsgi && adduser -S -g uwsgi uwsgi

WORKDIR /ci_testing_python

COPY requirements.txt /ci_testing_python/
RUN pip install -r requirements.txt
# RUN pip install --verbose uwsgi

COPY ci_testing_python /ci_testing_python/ci_testing_python/
COPY setup.py /ci_testing_python/
COPY setup.cfg /ci_testing_python/

COPY tests /ci_testing_python/tests/

RUN pip install --no-deps .

EXPOSE 5000 9090 9191
USER uwsgi

CMD ["./docker-entrypoint.sh"]

So now when I try to run the build command, this is the following error that I get.

$ docker build -t myapp:latest .
Sending build context to Docker daemon 92.67 kB
Step 1/15 : FROM python:3.4-alpine
 ---> 9ac5db25a0ca
Step 2/15 : RUN apk add --update --no-cache             pcre-dev
 ---> Using cache
 ---> 97037b3e67f5
Step 3/15 : RUN addgroup -S uwsgi && adduser -S -g uwsgi uwsgi
 ---> Using cache
 ---> e4647269bef5
Step 4/15 : WORKDIR /ci_testing_python
 ---> Using cache
 ---> dbd5cbf04260
Step 5/15 : COPY requirements/requirements-main.txt /ci_testing_python/
 ---> 5b1ff8a4ba15
Removing intermediate container 163a45c9e6f1
Step 6/15 : RUN pip install -r requirements-main.txt
 ---> Running in 78ab52d5ef57
Collecting Flask==0.12 (from -r requirements-main.txt (line 1))
  Downloading Flask-0.12-py2.py3-none-any.whl (82kB)
Collecting uwsgi==2.0.14 (from -r requirements-main.txt (line 2))
  Downloading uwsgi-2.0.14.tar.gz (788kB)
Collecting requests==2.13.0 (from -r requirements-main.txt (line 3))
  Downloading requests-2.13.0-py2.py3-none-any.whl (584kB)
Collecting redis==2.10.5 (from -r requirements-main.txt (line 4))
  Downloading redis-2.10.5-py2.py3-none-any.whl (60kB)
Collecting Jinja2>=2.4 (from Flask==0.12->-r requirements-main.txt (line 1))
  Downloading Jinja2-2.9.5-py2.py3-none-any.whl (340kB)
Collecting itsdangerous>=0.21 (from Flask==0.12->-r requirements-main.txt (line 1))
  Downloading itsdangerous-0.24.tar.gz (46kB)
Collecting Werkzeug>=0.7 (from Flask==0.12->-r requirements-main.txt (line 1))
  Downloading Werkzeug-0.12.1-py2.py3-none-any.whl (312kB)
Collecting click>=2.0 (from Flask==0.12->-r requirements-main.txt (line 1))
  Downloading click-6.7-py2.py3-none-any.whl (71kB)
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->Flask==0.12->-r requirements-main.txt (line 1))
  Downloading MarkupSafe-1.0.tar.gz
Installing collected packages: MarkupSafe, Jinja2, itsdangerous, Werkzeug, click, Flask, uwsgi, requests, redis
  Running setup.py install for MarkupSafe: started
    Running setup.py install for MarkupSafe: finished with status 'done'
  Running setup.py install for itsdangerous: started
    Running setup.py install for itsdangerous: finished with status 'done'
  Running setup.py install for uwsgi: started
    Running setup.py install for uwsgi: finished with status 'error'
    Complete output from command /usr/local/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zvqmmzqp/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-1l6suehh-record/install-record.txt --single-version-externally-managed --compile:
    running install
    using profile: buildconf/default.ini
    detected include path: ['/usr/include', '/usr/local/include']
    Traceback (most recent call last):
      File "/tmp/pip-build-zvqmmzqp/uwsgi/uwsgiconfig.py", line 734, in __init__
        gcc_version_components = gcc_version.split('.')
    AttributeError: 'NoneType' object has no attribute 'split'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-zvqmmzqp/uwsgi/setup.py", line 124, in <module>
        distclass=uWSGIDistribution,
      File "/usr/local/lib/python3.4/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/local/lib/python3.4/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/local/lib/python3.4/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-zvqmmzqp/uwsgi/setup.py", line 77, in run
        conf = uc.uConf(get_profile())
      File "/tmp/pip-build-zvqmmzqp/uwsgi/uwsgiconfig.py", line 742, in __init__
        raise Exception("you need a C compiler to build uWSGI")
    Exception: you need a C compiler to build uWSGI

    ----------------------------------------
Command "/usr/local/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zvqmmzqp/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-1l6suehh-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-zvqmmzqp/uwsgi/
The command '/bin/sh -c pip install -r requirements-main.txt' returned a non-zero code: 1

What is wrong here?

I have also looked into unbit/uwsgi/issues/1318 and gliderlabs/docker-alpine/issues/158 but both of them use alpine:3.4 as the base image and hence when trying to apk add the required packages it throws some error in installing those mentioned packages in mentioned in those issues.

Most linux package managers offer most things precompiled. For example on Ubuntu:

sudo apt install uwsgi-plugin-python3

This will make uwsgi globally available, not just within that one virtualenv, and is an alternative to installing a C compiler.

This is because there is no C compiler on the server. If you are using an instance on cloud like AWS or Digital Ocean gcc is typically not installed. So you need to install it manually

sudo apt update
sudo apt install gcc 
sudo pip install uwsgi # Sudo as the server requires root access

should solve the prolem

Your exception explicitly says what’s wrong:

gcc_version_components = gcc_version.split('.')
AttributeError: 'NoneType' object has no attribute 'split'

and

raise Exception("you need a C compiler to build uWSGI")
Exception: you need a C compiler to build uWSGI

So in general your system does not have c compiler installed (e.g. gcc). Try installing it. In Ubuntu it would be sudo apt-get install gcc.

BTW. I think this question would better fit askubuntu page.

Tags:

Python

Ubuntu

Uwsgi

Related

1. Install using pip

Error: os has no uname()

solve:

Locate the uwsgiconfig.py file, first after import platform, change all os.unam() to platform.uname().

os.uname() does not support windows system. The platform module is to support any system.

2. Download uwsgi offline installation

https://pypi.python.org/pypi/uWSGI/ 

After decompression, enter the directory

Error: Exception: you need a C compiler to builduWSGI

Solution: Configure the C compilation environment

If there is no C compilation environment on this machine, you need to download a compiler (MinGW/tinycc)

I have codeblocks installed on my computer, so I have installed MinGW, and then configure system variables

path=;MinGW directory/bin

http://jingyan.baidu.com/article/6b97984da0bd8a1ca2b0bf90.html

3. Install again

I thought that the installation was successful, but the result still reported an error. Later, I found out that Windows does not support uwsgi.

reference:

http://lists.unbit.it/pipermail/uwsgi/2011-May/002092.html

http://blog.csdn.net/sunhuaqiang1/article/details/70185022

https://docs.python.org/3/library/os.html?highlight=uname#os.uname

https://stackoverflow.com/questions/32163910/uwsgi-installation-error-in-windows-7

Я получил ошибку, Не удалось построить колесо для UWSGI. Моя среда — Ubuntu, теперь я хочу установить uwsgi, поэтому я запускаю команду pip install uwsgi. Но происходит ошибка

 Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-9t06jm4_/uwsgi/setup.py", line 126, in <module>
      distclass=uWSGIDistribution,
    File "/home/ubuntu/anaconda3/lib/python3.5/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/wheel/bdist_wheel.py", line 215, in run
      self.run_command('install')
    File "/home/ubuntu/anaconda3/lib/python3.5/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-9t06jm4_/uwsgi/setup.py", line 77, in run
      conf = uc.uConf(get_profile())
    File "/tmp/pip-build-9t06jm4_/uwsgi/uwsgiconfig.py", line 742, in __init__
      raise Exception("you need a C compiler to build uWSGI")
  Exception: you need a C compiler to build uWSGI

  ----------------------------------------
  Failed building wheel for uwsgi
  Running setup.py clean for uwsgi
Failed to build uwsgi
Installing collected packages: uwsgi
  Running setup.py install for uwsgi ... error
    Complete output from command /home/ubuntu/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9t06jm4_/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-oxbyg6gk-record/install-record.txt --single-version-externally-managed --compile:
    /home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'descriptions'
      warnings.warn(msg)
    running install
    using profile: buildconf/default.ini
    detected include path: ['/usr/include', '/usr/local/include']
    Traceback (most recent call last):
      File "/tmp/pip-build-9t06jm4_/uwsgi/uwsgiconfig.py", line 734, in __init__
        gcc_version_components = gcc_version.split('.')
    AttributeError: 'NoneType' object has no attribute 'split'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-9t06jm4_/uwsgi/setup.py", line 126, in <module>
        distclass=uWSGIDistribution,
      File "/home/ubuntu/anaconda3/lib/python3.5/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-9t06jm4_/uwsgi/setup.py", line 77, in run
        conf = uc.uConf(get_profile())
      File "/tmp/pip-build-9t06jm4_/uwsgi/uwsgiconfig.py", line 742, in __init__
        raise Exception("you need a C compiler to build uWSGI")
    Exception: you need a C compiler to build uWSGI

    ----------------------------------------
Command "/home/ubuntu/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9t06jm4_/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-oxbyg6gk-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-9t06jm4_/uwsgi/

Я запускаю команду sudo apt-get -y install python-dev, но возникает та же ошибка. Я действительно не могу понять, почему происходит эта ошибка. Как мне это исправить? Почему мне сказали, что мне нужен компилятор C в uWSGI? Как мне это исправить? ?

3 ответа

Лучший ответ

Ваше исключение явно говорит о том, что не так:

gcc_version_components = gcc_version.split('.')
AttributeError: 'NoneType' object has no attribute 'split'

И

raise Exception("you need a C compiler to build uWSGI")
Exception: you need a C compiler to build uWSGI

В общем, в вашей системе не установлен компилятор c (например, gcc). Попробуйте установить его. В Ubuntu это будет sudo apt-get install gcc.

КСТАТИ . Я думаю, что этот вопрос лучше подходит для страницы askubuntu.


4

running.t
18 Дек 2017 в 12:10

Это потому, что на сервере нет компилятора C. Если вы используете экземпляр в облаке, например AWS или Digital Ocean, gcc обычно не устанавливается. Так что вам нужно установить его вручную

sudo apt update
sudo apt install gcc 
sudo pip install uwsgi # Sudo as the server requires root access

Должен решить проблему


0

Tessaracter
19 Ноя 2019 в 14:14

Большинство менеджеров пакетов Linux предлагают большинство скомпилированных вещей. Например, в Ubuntu:

sudo apt install uwsgi-plugin-python3

Это сделает uwsgi глобально доступным, а не только в пределах одного virtualenv, и станет альтернативой установке компилятора Си.


0

John Mee
27 Авг 2019 в 08:28

Понравилась статья? Поделить с друзьями:
  • Exception processing message 0xc0000005 unexpected parameters windows 10 как исправить
  • Exception eolesyserror in module класс не зарегистрирован windows 7
  • Exception access violation 0xc0000005 windows 10
  • Excel скачать торрент для windows 10 x64 c ключом
  • Excel скачать крякнутый для windows 10 torrent