最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

關(guān)于pip install uwsgi安裝失敗問題的解決方案

 更新時間:2023年06月12日 10:23:25   作者:小龍狗  
這篇文章主要介紹了關(guān)于pip install uwsgi安裝失敗問題的解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教

pip install uwsgi安裝失敗問題解決

問題描述

Linux下使用python開發(fā),需要uwsgi模塊時,常常會出現(xiàn)pip install 失敗的情況,就像下圖這樣。

是什么原因造成的呢?

因為缺少一個python-devel包,所以只需要下載安裝這個包就可以解決了。

但是要特別注意python版本要與之對應(yīng)的問題。

[root@VM_0_13_centos ~]# pip install uwsgi
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Collecting uwsgi
  Downloading http://mirrors.tencentyun.com/pypi/packages/98/b2/19b34b20662d111f7d2f926cdf10e13381761dd7dbd10666b9076cbdcd22/uwsgi-2.0.17.tar.gz (798kB)
    100% |████████████████████████████████| 798kB 2.6MB/s 
Installing collected packages: uwsgi
  Running setup.py install for uwsgi ... error
******省略******
    [gcc -pthread] core/config_py.o
    *** uWSGI compiling embedded plugins ***
    [gcc -pthread] plugins/python/python_plugin.o
    In file included from plugins/python/python_plugin.c:1:0:
    plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    ----------------------------------------
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-e385dqxe/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-azcl8hbu/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-e385dqxe/uwsgi/

解決辦法

從yum源上下載安裝對應(yīng)python版本的python-devel,如果不清楚的話先用 python --version 命令查看python版本,然后yum search python3,Tab鍵搜索出來下載。

[root@VM_0_13_centos ~]# yum install python36u-devel
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration*
******省略******
Installed:
? python36u-devel.x86_64 0:3.6.5-1.ius.centos7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
Complete!

Python-dev是個啥?

linux發(fā)行版通常會把類庫的頭文件和相關(guān)的pkg-config分拆成一個單獨的xxx-dev(el)包.以下情況需要python-dev包:

1.安裝一個源外的python類庫, 而這個類庫內(nèi)含需要編譯的調(diào)用python api的c/c++文件;

2.自己寫的一個程序編譯需要鏈接libpythonXX.(a|so)

(不含使用ctypes/ffi或者裸dlsym方式直接調(diào)用libpython.so)

其他正常使用python或者通過安裝源內(nèi)的python類庫的不需要python-dev.

linux下通過pip安裝最新uwsgi

通過yum install uwsgi 安裝的uwsgi在進行測試的時候,發(fā)現(xiàn)版本是2.0.15,但是啟動uwsgi測試的時候報參數(shù)錯誤,后來改用pip安裝(先yum remove uwsgi刪除老的uwsgi)就成功了。uwsgi安裝完成之后的樣子

安裝pip

wget  https://bootstrap.pypa.io/get-pip.py
python ./get-pip.py

安裝uwsgi,一個干凈的linux系統(tǒng)安裝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

解決辦法:yum install gcc-*

另外一個錯誤:

fatal error: Python.h: No such file or directory

解決辦法:yum install python-devel

安裝成功的打印信息:

[root@VM_68_155_centos ~]# pip install uwsgi
Collecting uwsgi
  Using cached uwsgi-2.0.16.tar.gz
Building wheels for collected packages: uwsgi
  Running setup.py bdist_wheel for uwsgi ... done
  Stored in directory: /root/.cache/pip/wheels/3a/e7/aa/24207bb9d885fe11fab3f7ad7d9d80c538a423d98494d43fd7
Successfully built uwsgi
Installing collected packages: uwsgi
Successfully installed uwsgi-2.0.16
[root@VM_68_155_centos ~]# 

編輯一個簡單的測試文件hello.py:

def application(env,start_response):
        start_response('200 OK',[('Content-Type','text/html')])
        return "Hello,world"

啟動uwsgi : uwsgi --http-socket :80 --wsgi-file hello.py

[root@VM_68_155_centos ~]# /usr/bin/uwsgi --http-socket :80 --wsgi-file hello.py 
*** Starting uWSGI 2.0.16 (64bit) on [Fri Feb 23 15:31:16 2018] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-16) on 23 February 2018 07:28:20
os: Linux-3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017
nodename: VM_68_155_centos
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /root
detected binary path: /usr/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
dropping root privileges as early as possible
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 3895
your memory page size is 4096 bytes
detected max file descriptor number: 100001
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :80 fd 3
dropping root privileges after socket binding
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Python version: 2.7.5 (default, Aug  4 2017, 00:39:18)  [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x7d64c0
dropping root privileges after plugin initialization
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72904 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x7d64c0 pid: 6557 (default app)
dropping root privileges after application loading
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 6557, cores: 1)

測試uwsgi-server

總結(jié)

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • OpenCV簡單標準數(shù)字識別的完整實例

    OpenCV簡單標準數(shù)字識別的完整實例

    這篇文章主要給大家介紹了關(guān)于OpenCV簡單標準數(shù)字識別的相關(guān)資料,要通過opencv 進行數(shù)字識別離不開訓(xùn)練庫的支持,需要對目標圖片進行大量的訓(xùn)練,才能做到精準的識別出目標數(shù)字,需要的朋友可以參考下
    2021-09-09
  • 10個殺手級應(yīng)用的Python自動化腳本

    10個殺手級應(yīng)用的Python自動化腳本

    重復(fù)的任務(wù)總是耗費時間和枯燥的。如果逐一裁剪100張照片,或者做諸如Fetching APIs、糾正拼寫和語法等任務(wù),所有這些都需要大量的時間。為什么不把它們自動化呢?本文詳細介紹了10個Python自動化腳本,感興趣的小伙伴可以閱讀一下
    2023-03-03
  • python高階爬蟲實戰(zhàn)分析

    python高階爬蟲實戰(zhàn)分析

    這篇文章給大家分享了python高階爬蟲實戰(zhàn)的相關(guān)實例內(nèi)容以及技巧分析,有興趣的朋友參考下。
    2018-07-07
  • 編寫自定義的Django模板加載器的簡單示例

    編寫自定義的Django模板加載器的簡單示例

    這篇文章主要介紹了編寫自定義的Django模板加載器的簡單示例,Django是各色人氣Python框架中最為著名的一個,需要的朋友可以參考下
    2015-07-07
  • 利用python?pywifi實現(xiàn)破解WiFi密碼

    利用python?pywifi實現(xiàn)破解WiFi密碼

    家里沒有怎么辦,只要你會Python,辦法總比困難多,本文就利用pywifi?這個庫實驗一下如何破解Wi-Fi?密碼,注意,該方法僅可用來研究學(xué)習(xí)所用,需要的朋友可以參考下
    2024-03-03
  • python開發(fā)之函數(shù)定義實例分析

    python開發(fā)之函數(shù)定義實例分析

    這篇文章主要介紹了python開發(fā)之函數(shù)定義方法,以實例形式較為詳細的分析了Python中函數(shù)的定義與使用技巧,需要的朋友可以參考下
    2015-11-11
  • Python中的分支與循環(huán)結(jié)構(gòu)解讀

    Python中的分支與循環(huán)結(jié)構(gòu)解讀

    這篇文章主要介紹了Python中的分支與循環(huán)結(jié)構(gòu)解讀,在Python編程中,分支(Branch)和循環(huán)(Loop)是掌握的關(guān)鍵要素之一,它們允許您根據(jù)條件執(zhí)行不同的代碼塊,以及重復(fù)執(zhí)行特定任務(wù),需要的朋友可以參考下
    2023-10-10
  • Python變量格式化輸出實現(xiàn)原理解析

    Python變量格式化輸出實現(xiàn)原理解析

    這篇文章主要介紹了Python變量格式化輸出實現(xiàn)原理解析,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2020-08-08
  • pycharm如何調(diào)整最大堆發(fā)揮最大

    pycharm如何調(diào)整最大堆發(fā)揮最大

    本文詳細介紹了如何在PyCharmar中設(shè)置最大堆內(nèi)存以提高Python程序運行效率,建議將8GB內(nèi)存設(shè)置為約6GB,利用約75%的內(nèi)存運行效果最佳
    2026-05-05
  • 如何更改Pycharm配置文件的存放路徑

    如何更改Pycharm配置文件的存放路徑

    Pycharm配置文件默認是放在C盤的,修改存放位置,這樣系統(tǒng)重裝的時候就不會不見了,下面這篇文章主要給大家介紹了關(guān)于如何更改Pycharm配置文件的存放路徑的相關(guān)資料,需要的朋友可以參考下
    2022-12-12

最新評論

常德市| 阳曲县| 宁国市| 雷波县| 广南县| 白朗县| 左云县| 昌江| 灵台县| 柳林县| 林州市| 阳信县| 绍兴市| 承德县| 紫阳县| 保靖县| 太和县| 阿拉善左旗| 阜新| 噶尔县| 蒙阴县| 鄂伦春自治旗| 东丰县| 庆阳市| 砀山县| 鸡泽县| 平果县| 抚宁县| 白水县| 黑山县| 赫章县| 曲阳县| 临沭县| 百色市| 昭苏县| 天全县| 天峻县| 南通市| 神农架林区| 诸暨市| 德化县|