python - 无法在 Ubuntu 20.04 中使用 python 3.9 安装 gwpy 包
问题描述
我正在尝试在 Ubuntu 20.04 和 Python 3.9 中安装gwpy包
虽然使用以下命令成功安装了 python 3.8,但无法使其适用于 Python 3.9
pip3 install gwpy
上面的命令成功安装gwpy
在目录中/.local/lib/python3.8/site-packages
,并且在 Python 3.8 上运行良好
但是当我选择 Python 3.9 时,gwpy
模块没有被识别并得到“ImportError:没有名为 gwpy 的模块”
已尝试以下命令用于 Python 3.9
python3.9 -m pip install
并且,
pip3.9 install gwpy
但得到同样的错误(下)
(我已经卸载并重新安装了 ligo-segments )
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.
我已经完全删除了 Python 3.9,并在我的系统中重新安装了它。
解决方案
推荐阅读
- python - SK-Learn 预处理流水线,垃圾输出
- c++ - 为什么我得到一个长度仅为 3 的字符串排列的输出?
- angular - 如何在 Ionic 4 中更新离子搜索栏的高度?
- c# - 如何将唯一参数传递给 Inetlab 客户端,例如数据库 ID?
- java - 尝试绘制自定义视图如何检测单击了哪个切片
- c++ - 如何将 Caesar Cipher 的元素从字符串更改为字符串
- security - 什么是 iFrame 政策?
- c# - 如何在水晶报表Visual Studio中制作二维码
- html - 为什么网格包含溢出项目时会溢出父网格?
- python - 如果本地存储库中不存在文件夹,则克隆-Python flask