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

 安装pot模块的时候发现报错如下:

sudo pip3 install pot
The directory '/home/wdong/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/wdong/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pot
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f68b137e320>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /packages/28/4b/7aaa1f840a359f5953dd378e0237fa8faf9b0a415ff7282b7375fbe68d27/POT-0.5.1.tar.gz
  Downloading https://files.pythonhosted.org/packages/28/4b/7aaa1f840a359f5953dd378e0237fa8faf9b0a415ff7282b7375fbe68d27/POT-0.5.1.tar.gz (720kB)
    100% |████████████████████████████████| 727kB 90kB/s 
Requirement already satisfied: numpy in /usr/local/lib/python3.5/dist-packages (from pot) (1.16.2)
Requirement already satisfied: scipy in /usr/local/lib/python3.5/dist-packages (from pot) (1.2.1)
Requirement already satisfied: cython in /usr/local/lib/python3.5/dist-packages (from pot) (0.29.6)
Requirement already satisfied: matplotlib in /usr/local/lib/python3.5/dist-packages (from pot) (3.0.3)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.5/dist-packages (from matplotlib->pot) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.5/dist-packages (from matplotlib->pot) (1.0.1)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.5/dist-packages (from matplotlib->pot) (2.8.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/lib/python3/dist-packages (from matplotlib->pot) (2.0.3)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from cycler>=0.10->matplotlib->pot) (1.10.0)
Requirement already satisfied: setuptools in /usr/local/lib/python3.5/dist-packages (from kiwisolver>=1.0.1->matplotlib->pot) (40.8.0)
Installing collected packages: pot
  Running setup.py install for pot ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-hp2npzwa/pot/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-ebdwbzel/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/ot
    copying ot/dr.py -> build/lib.linux-x86_64-3.5/ot
    copying ot/__init__.py -> build/lib.linux-x86_64-3.5/ot
    copying ot/gromov.py -> build/lib.linux-x86_64-3.5/ot
    copying ot/da.py -> build/lib.linux-x86_64-3.5/ot
    copying ot/plot.py -> build/lib.linux-x86_64-3.5/ot
    copying ot/utils.py -> build/lib.linux-x86_64-3.5/ot
    copying ot/datasets.py -> build/lib.linux-x86_64-3.5/ot
    copying ot/stochastic.py -> build/lib.linux-x86_64-3.5/ot
    copying ot/bregman.py -> build/lib.linux-x86_64-3.5/ot
    copying ot/optim.py -> build/lib.linux-x86_64-3.5/ot
    copying ot/smooth.py -> build/lib.linux-x86_64-3.5/ot
    creating build/lib.linux-x86_64-3.5/ot/gpu
    copying ot/gpu/__init__.py -> build/lib.linux-x86_64-3.5/ot/gpu
    copying ot/gpu/da.py -> build/lib.linux-x86_64-3.5/ot/gpu
    copying ot/gpu/utils.py -> build/lib.linux-x86_64-3.5/ot/gpu
    copying ot/gpu/bregman.py -> build/lib.linux-x86_64-3.5/ot/gpu
    creating build/lib.linux-x86_64-3.5/ot/lp
    copying ot/lp/__init__.py -> build/lib.linux-x86_64-3.5/ot/lp
    copying ot/lp/cvx.py -> build/lib.linux-x86_64-3.5/ot/lp
    creating build/lib.linux-x86_64-3.5/ot/externals
    copying ot/externals/__init__.py -> build/lib.linux-x86_64-3.5/ot/externals
    copying ot/externals/funcsigs.py -> build/lib.linux-x86_64-3.5/ot/externals
    running build_ext
    building 'ot.lp.emd_wrap' extension
    creating build/temp.linux-x86_64-3.5
    creating build/temp.linux-x86_64-3.5/ot
    creating build/temp.linux-x86_64-3.5/ot/lp
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iot/lp -I/usr/local/lib/python3.5/dist-packages/numpy/core/include -I/tmp/pip-install-hp2npzwa/pot/ot/lp -I/usr/include/python3.5m -c ot/lp/emd_wrap.cpp -o build/temp.linux-x86_64-3.5/ot/lp/emd_wrap.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    ot/lp/emd_wrap.cpp:28:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-hp2npzwa/pot/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-ebdwbzel/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-hp2npzwa/pot/

解决方法:

sudo apt-get install python-dev   # for python2.x installs
sudo apt-get install python3-dev  # for python3.x installs

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
在编译Redis时,出现了"zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory"的错误。这个错误出现是因为编译器找不到jemalloc库的头文件,导致编译失败。 要解决这个问题,你可以按照以下步骤进行: 1. 确保你已经正确安装了jemalloc库。你可以从jemalloc的官方网站下载并按照安装指南进行安装。 2. 如果你已经安装了jemalloc库,但编译器仍然找不到头文件,那么可能是因为头文件的路径没有正确配置。你可以在编译Redis之前,通过设置环境变量或者修改编译选项的方式来指定头文件的路径。具体的做法取决于你使用的编译工具和操作系统。 3. 另外,你还可以尝试使用其他的内存分配器,如libc的malloc或者tcmalloc。这些内存分配器在大多数系统上都是默认可用的,可以通过修改Redis的配置文件或者编译选项来切换内存分配器。 总结起来,要解决"zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory"的错误,你可以通过安装jemalloc库、配置头文件路径或者切换其他内存分配器的方式来解决。希望这些方法对你有帮助!<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [redis编译报错:zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory](https://blog.csdn.net/qq_50247813/article/details/128866027)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [fatal error: boostdesc_bgm.i: No such file or directory补充文件](https://download.csdn.net/download/qq_26631621/44054087)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [编译redis的时候出现zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory问题...](https://blog.csdn.net/AZXHNLS81/article/details/104569746)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值