首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >无法在Ubuntu20.04中安装python 3.9的gwpy包

无法在Ubuntu20.04中安装python 3.9的gwpy包
EN

Stack Overflow用户
提问于 2021-08-16 08:54:59
回答 1查看 296关注 0票数 0

我试图用Ubuntu20.04和Python3.9安装格鲁比软件包

使用以下命令成功安装python 3.8,但无法使其在Python3.9中工作

代码语言:javascript
运行
AI代码解释
复制
pip3 install gwpy

上面的命令成功地将gwpy安装在/.local/lib/python3.8/site-packages目录中,并使用Python3.8很好地工作。

但是,当我选择Python3.9时,gwpy模块就没有得到识别,也没有得到"ImportError: No模块名为gwpy“。

已经为Python3.9尝试了以下命令

代码语言:javascript
运行
AI代码解释
复制
python3.9 -m pip install

而且,

代码语言:javascript
运行
AI代码解释
复制
pip3.9 install gwpy

但是得到相同的错误(下面)

(我已经卸载和重新安装了ligo-段)

代码语言:javascript
运行
AI代码解释
复制
Building wheels for collected packages: ligo-segments
  Building wheel for ligo-segments (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-l_etxqfg/ligo-segments_093d6d7361fe403dba837e6e5793581f/setup.py'"'"'; __file__='"'"'/tmp/pip-install-l_etxqfg/ligo-segments_093d6d7361fe403dba837e6e5793581f/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-m3l2cb3f
       cwd: /tmp/pip-install-l_etxqfg/ligo-segments_093d6d7361fe403dba837e6e5793581f/
  Complete output (20 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/ligo
  copying ligo/__init__.py -> build/lib.linux-x86_64-3.9/ligo
  creating build/lib.linux-x86_64-3.9/ligo/segments
  copying ligo/segments/utils.py -> build/lib.linux-x86_64-3.9/ligo/segments
  copying ligo/segments/__init__.py -> build/lib.linux-x86_64-3.9/ligo/segments
  running build_ext
  building 'ligo.segments.__segments' extension
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/src
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Isrc -I/usr/include/python3.9 -c src/infinity.c -o build/temp.linux-x86_64-3.9/src/infinity.o
  src/infinity.c:29:10: fatal error: Python.h: No such file or directory
     29 | #include <Python.h>
        |          ^~~~~~~~~~
  compilation terminated.
  error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for ligo-segments
  Running setup.py clean for ligo-segments
Failed to build ligo-segments
Installing collected packages: ligo-segments, pyerfa, gwdatafind, tqdm, ligotimegps, h5py, gwosc, dqsegdb2, astropy, gwpy
    Running setup.py install for ligo-segments ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-l_etxqfg/ligo-segments_093d6d7361fe403dba837e6e5793581f/setup.py'"'"'; __file__='"'"'/tmp/pip-install-l_etxqfg/ligo-segments_093d6d7361fe403dba837e6e5793581f/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-7g5qg2rc/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/paul/.local/include/python3.9/ligo-segments
         cwd: /tmp/pip-install-l_etxqfg/ligo-segments_093d6d7361fe403dba837e6e5793581f/
    Complete output (20 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/ligo
    copying ligo/__init__.py -> build/lib.linux-x86_64-3.9/ligo
    creating build/lib.linux-x86_64-3.9/ligo/segments
    copying ligo/segments/utils.py -> build/lib.linux-x86_64-3.9/ligo/segments
    copying ligo/segments/__init__.py -> build/lib.linux-x86_64-3.9/ligo/segments
    running build_ext
    building 'ligo.segments.__segments' extension
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/src
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Isrc -I/usr/include/python3.9 -c src/infinity.c -o build/temp.linux-x86_64-3.9/src/infinity.o
    src/infinity.c:29:10: fatal error: Python.h: No such file or directory
       29 | #include <Python.h>
          |          ^~~~~~~~~~
    compilation terminated.
    error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-l_etxqfg/ligo-segments_093d6d7361fe403dba837e6e5793581f/setup.py'"'"'; __file__='"'"'/tmp/pip-install-l_etxqfg/ligo-segments_093d6d7361fe403dba837e6e5793581f/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-7g5qg2rc/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/paul/.local/include/python3.9/ligo-segments Check the logs for full command output.

我已经完全删除了Python3.9,并且在我的系统中重新安装了它。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-08-16 09:10:47

从问题底部的@Sujay的非常有用的评论中找到了解决方案。

来自这是如此的帖子

刚刚安装在下面

代码语言:javascript
运行
AI代码解释
复制
sudo apt-get install python3.9-dev
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68806576

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档