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

如何在Ubuntu 17.04上的Pypy virtualenv中安装iPython,ubuntu,ipython,virtualenv,pypy,Ubuntu,Ipython,Virtualenv,Pypy,我正试图在一个virtualenv中安装IPython。我已经将我的Virtualenv设置为使用PyPy2.7而不是CPython3 当我使用由apt get安装的IPython时,它最终使用的是cpython3而不是Pypy 当我尝试pip安装ipython时,我得到一个编译错误,因为它找不到Python.h头文件。此错误详细信息如下:。建议的修复会导致以下错误: 无法执行'--user'安装。用户站点包在此virtualenv中不可见 [编辑] 完全错误: Collecting ipyth

我正试图在一个virtualenv中安装IPython。我已经将我的Virtualenv设置为使用PyPy2.7而不是CPython3

当我使用由apt get安装的IPython时,它最终使用的是cpython3而不是Pypy


当我尝试
pip安装ipython
时,我得到一个编译错误,因为它找不到
Python.h
头文件。此错误详细信息如下:。建议的修复会导致以下错误:

无法执行'--user'安装。用户站点包在此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/
收集ipython
使用缓存的ipython-5.4.1-py2-none-any.whl
已满足要求:装修工/现场包(来自ipython)
收集PickerShare(来自ipython)
使用缓存的pickleshare-0.7.4-py2.py3-none-any.whl
收集提示toolkit=1.0.4(来自ipython)
使用缓存的prompt_toolkit-1.0.15-py2-none-any.whl
收集pygments(来自ipython)
使用缓存的Pygments-2.2.0-py2.py3-none-any.whl
已满足要求:setuptools>=18.5英寸/站点包(来自ipython)
收集simplegeneric>0.8(来自ipython)
收集traitlets>=4.2(来自ipython)
使用缓存的traitlets-4.3.2-py2.py3-none-any.whl
收集backport.shutil-get-terminal-size;python_version==“2.7”(来自ipython)
使用缓存的backport.shutil\u get\u terminal\u size-1.0.0-py2.py3-none-any.whl
收集路径lib2;python_版本==“2.7”或python_版本==“3.3”(来自ipython)
使用缓存的路径lib2-2.3.0-py2.py3-none-any.whl
收集期望值;系统平台!=“win32”(来自ipython)
使用缓存的pexpect-4.2.1-py2.py3-none-any.whl
已满足要求:六个>=1.9.0 in./site包(来自prompt toolkit=1.0.4->ipython)
收集wcwidth(从提示toolkit=1.0.4->ipython)
使用缓存的wcwidth-0.1.7-py2.py3-none-any.whl
收集ipython膝(从traitlets>=4.2->ipython)
使用缓存的ipython_genutils-0.2.0-py2.py3-none-any.whl
已满足的要求:34;python_version==/site包中的“2.7”(来自traitlets>=4.2->ipython)
收集丑闻;python_版本<“3.5”(来自pathlib2;python_版本==“2.7”或python_版本==“3.3”->ipython)
使用缓存的scandir-1.5.tar.gz
正在收集ptyprocess>=0.5(来自pexpect;系统平台!=“win32”->ipython)
使用缓存的ptyprocess-0.5.2-py2.py3-none-any.whl
为收集的包构建控制盘:scandir
正在运行用于扫描的setup.py bList\u控制盘。。。错误
从命令/home/me/Documents/pypy-ipython-venv/bin/pypy-u-c“导入setuptools,tokenize;uu文件uu=”/tmp/pip-build-FmKqsi/scandir/setup.py';f=getattr(tokenize,'open',open)(uuuu文件);code=f.read().replace('\r\n','n');f.close();exec(compile(code,uu文件,'python'))“exec”)“ist-wheel-d/tmp/pipW7pproel:
运转的车轮
运行构建
运行build\u py
创建构建
创建build/lib.linux-x86_64-2.7
正在复制scandir.py->build/lib.linux-x86_64-2.7
运行build_ext
建筑“\u scandir”扩展
创建build/temp.linux-x86_64-2.7
cc-O2-fPIC-Wimplicit-I/home/me/Documents/pypy-ipython-venv/include-c\u scandir.c-o build/temp.linux-x86\u 64-2.7/\u scandir.o
_scandir.c:14:20:致命错误:Python.h:没有这样的文件或目录
#包括
^
编译终止。
错误:命令“cc”失败,退出状态为1
----------------------------------------
为scandir构建控制盘失败
正在为scandir运行setup.py clean
未能生成scandir
安装收集的软件包:scandir、pathlib2、pickleshare、wcwidth、prompt toolkit、pygments、simplegeneric、ipython genutils、traitlets、backports.shutil-get-terminal-size、ptyprocess、pexpect、ipython
正在为scandir运行setup.py安装。。。错误
从命令/home/me/Documents/pypy-ipython-venv/bin/pypy-u-c“导入setuptools,标记化;uu-file_uuu=”/tmp/pip-build-FmKqsi/scandir/setup.py';f=getattr(标记化,'open',open)(u文件,'code=f.read().替换('\r\n','n');f.close();exec(编译(代码,'uu-file,'exec'))”安装--record/tmp/pip RqBbsa record/install-record.txt--外部管理的单一版本--编译--install headers/home/me/Documents/pypy-ipython-venv/include/site/python2.7/scandir:
正在运行的安装
运行构建
运行build\u py
创建构建
创建build/lib.linux-x86_64-2.7
正在复制scandir.py->build/lib.linux-x86_64-2.7
运行build_ext
建筑“\u scandir”扩展
创建build/temp.linux-x86_64-2.7
cc-O2-fPIC-Wimplicit-I/home/me/Documents/pypy-ipython-venv/include-c\u scandir.c-o build/temp.linux-x86\u 64-2.7/\u scandir.o
_scandir.c:14:20:致命错误:Python.h:没有这样的文件或目录
#包括
^
编译终止。
错误:命令“cc”失败,退出状态为1
----------------------------------------
命令“/home/me/Documents/pypy-ipython-venv/bin/pypy-u-c”导入setuptools,标记化__文件\ \='/tmp/pip build FmKqsi/scandir/setup.py';f=getattr(标记化“打开”,打开)(_文件);code=f.read().replace('\r\n','\n');f、 close();exec(compile(code,_ufile,_u,'exec'))“安装--record/tmp/pip RqBbsa record/install-record.txt--外部管理的单一版本--编译--install headers/home/me/Documents/pypypy-ipython-venv/include/site/python2.7/scandir”失败,错误代码为1,出现在/tmp/pip-build-FmKqsi/scandir中/

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

请注意,您只需要安装pypy-dev一次,然后就可以使用尽可能多的VirtualNV了