gpt4 book ai didi

ubuntu - 如何在 Ubuntu 17.04 上的 Pypy virtualenv 中安装 iPython

转载 作者:行者123 更新时间:2023-12-04 18:55:58 25 4
gpt4 key购买 nike

我正在尝试在 virtualenv 中安装 IPython。我已将 Virtualenv 设置为使用 Pypy 2.7 而不是 CPython 3。

当我使用 apt-get 安装的 IPython 时,它最终使用 CPython 3 而不是 Pypy。

当我尝试 pip install ipython ,我得到一个编译错误,因为它找不到 Python.h头文件。此错误在此处详细说明:https://askubuntu.com/questions/922302/install-ipython-with-pip-on-ubuntu-16-04 .建议的修复会导致错误:

Can not perform a '--user' install. User site-packages are not visible in this virtualenv.



[编辑]

完整的错误:
Collecting ipython
Using cached ipython-5.4.1-py2-none-any.whl
Requirement already satisfied: decorator in ./site-packages (from ipython)
Collecting pickleshare (from ipython)
Using cached pickleshare-0.7.4-py2.py3-none-any.whl
Collecting prompt-toolkit<2.0.0,>=1.0.4 (from ipython)
Using cached prompt_toolkit-1.0.15-py2-none-any.whl
Collecting pygments (from ipython)
Using cached Pygments-2.2.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools>=18.5 in ./site-packages (from ipython)
Collecting simplegeneric>0.8 (from ipython)
Collecting traitlets>=4.2 (from ipython)
Using cached traitlets-4.3.2-py2.py3-none-any.whl
Collecting backports.shutil-get-terminal-size; python_version == "2.7" (from ipython)
Using cached backports.shutil_get_terminal_size-1.0.0-py2.py3-none-any.whl
Collecting pathlib2; python_version == "2.7" or python_version == "3.3" (from ipython)
Using cached pathlib2-2.3.0-py2.py3-none-any.whl
Collecting pexpect; sys_platform != "win32" (from ipython)
Using cached pexpect-4.2.1-py2.py3-none-any.whl
Requirement already satisfied: six>=1.9.0 in ./site-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
Collecting wcwidth (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
Using cached wcwidth-0.1.7-py2.py3-none-any.whl
Collecting ipython-genutils (from traitlets>=4.2->ipython)
Using cached ipython_genutils-0.2.0-py2.py3-none-any.whl
Requirement already satisfied: enum34; python_version == "2.7" in ./site-packages (from traitlets>=4.2->ipython)
Collecting scandir; python_version < "3.5" (from pathlib2; python_version == "2.7" or python_version == "3.3"->ipython)
Using cached scandir-1.5.tar.gz
Collecting ptyprocess>=0.5 (from pexpect; sys_platform != "win32"->ipython)
Using cached ptyprocess-0.5.2-py2.py3-none-any.whl
Building wheels for collected packages: scandir
Running setup.py bdist_wheel for scandir ... error
Complete output from command /home/me/Documents/pypy-ipython-venv/bin/pypy -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-FmKqsi/scandir/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpseW7pdpip-wheel- --python-tag pp256:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying scandir.py -> build/lib.linux-x86_64-2.7
running build_ext
building '_scandir' extension
creating build/temp.linux-x86_64-2.7
cc -O2 -fPIC -Wimplicit -I/home/me/Documents/pypy-ipython-venv/include -c _scandir.c -o build/temp.linux-x86_64-2.7/_scandir.o
_scandir.c:14:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'cc' failed with exit status 1

----------------------------------------
Failed building wheel for scandir
Running setup.py clean for scandir
Failed to build scandir
Installing collected packages: scandir, pathlib2, pickleshare, wcwidth, prompt-toolkit, pygments, simplegeneric, ipython-genutils, traitlets, backports.shutil-get-terminal-size, ptyprocess, pexpect, ipython
Running setup.py install for scandir ... error
Complete output from command /home/me/Documents/pypy-ipython-venv/bin/pypy -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-FmKqsi/scandir/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-RqBbsa-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/me/Documents/pypy-ipython-venv/include/site/python2.7/scandir:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying scandir.py -> build/lib.linux-x86_64-2.7
running build_ext
building '_scandir' extension
creating build/temp.linux-x86_64-2.7
cc -O2 -fPIC -Wimplicit -I/home/me/Documents/pypy-ipython-venv/include -c _scandir.c -o build/temp.linux-x86_64-2.7/_scandir.o
_scandir.c:14:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'cc' failed with exit status 1

----------------------------------------
Command "/home/me/Documents/pypy-ipython-venv/bin/pypy -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-FmKqsi/scandir/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-RqBbsa-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/me/Documents/pypy-ipython-venv/include/site/python2.7/scandir" failed with error code 1 in /tmp/pip-build-FmKqsi/scandir/

最佳答案

你需要安装 pypy-dev 之前 创建虚拟环境。您可以看到 gcc 命令正在/home/me/Documents/pypy-ipython-venv/include 中查找包含文件,我担心只有在创建虚拟环境时存在头文件时才能正确填充该目录。您可以通过查看该目录的内容来证明这一点,那里应该有一个 Python.h 文件。

请注意,您只需要安装一次 pypy-dev,之后您应该可以选择创建尽可能多的 virtualenvs

关于ubuntu - 如何在 Ubuntu 17.04 上的 Pypy virtualenv 中安装 iPython,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45969492/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com