Pip在安装vpnoteb时出错

2024-10-03 23:23:18 发布

您现在位置:Python中文网/ 问答频道 /正文

Vpython版本在他们的网站上没有,但是根据https://groups.google.com/forum/#!topic/vpython-users/AmIZF2v4Wkc,“pip install Vpython”应该适用于任何版本的Python。 我在windows命令提示符中输入了“pip install vpython”。下载几分钟后,pip给了我以下错误:

  Running setup.py install for vpnotebook ... error
    Complete output from command c:\users\zachary\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Zachary\\AppData\\Local\\Temp\\pip-build-dx_wvbg0\\vpnotebook\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Zachary\AppData\Local\Temp\pip-3q5u2e2l-record\install-record.txt --single-version-externally-managed --compile:
    ImportError install_kernel_spec
    c:\users\zachary\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\dist.py:331: UserWarning: Normalizing '0.1.03' to '0.1.3'
      normalized_version,
    running install
    Installing Python module...
    running build
    running build_py
    creating build
    creating build\lib
    creating build\lib\vpnotebook
    copying vpnotebook\__init__.py -> build\lib\vpnotebook
    creating build\lib\vpnotebook\data
    copying vpnotebook\data\kernel.json -> build\lib\vpnotebook\data
    running install_lib
    creating c:\users\zachary\appdata\local\programs\python\python36-32\Lib\site-packages\vpnotebook
    creating c:\users\zachary\appdata\local\programs\python\python36-32\Lib\site-packages\vpnotebook\data
    copying build\lib\vpnotebook\data\kernel.json -> c:\users\zachary\appdata\local\programs\python\python36-32\Lib\site-packages\vpnotebook\data
    copying build\lib\vpnotebook\__init__.py -> c:\users\zachary\appdata\local\programs\python\python36-32\Lib\site-packages\vpnotebook
    byte-compiling c:\users\zachary\appdata\local\programs\python\python36-32\Lib\site-packages\vpnotebook\__init__.py to __init__.cpython-36.pyc
    running install_egg_info
    running egg_info
    writing vpnotebook.egg-info\PKG-INFO
    writing dependency_links to vpnotebook.egg-info\dependency_links.txt
    writing top-level names to vpnotebook.egg-info\top_level.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'vpnotebook.egg-info\SOURCES.txt'
    writing manifest file 'vpnotebook.egg-info\SOURCES.txt'
    Copying vpnotebook.egg-info to c:\users\zachary\appdata\local\programs\python\python36-32\Lib\site-packages\vpnotebook-0.1.3-py3.6.egg-info
    running install_scripts
    writing list of installed files to 'C:\Users\Zachary\AppData\Local\Temp\pip-3q5u2e2l-record\install-record.txt'
    Installing custom kernel ...
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Zachary\AppData\Local\Temp\pip-build-dx_wvbg0\vpnotebook\setup.py", line 30, in <module>
        package_data={'vpnotebook': ['data/kernel.json']},
      File "c:\users\zachary\appdata\local\programs\python\python36-32\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\users\zachary\appdata\local\programs\python\python36-32\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "c:\users\zachary\appdata\local\programs\python\python36-32\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\Zachary\AppData\Local\Temp\pip-build-dx_wvbg0\vpnotebook\vpnotebook\__init__.py", line 72, in run
        run_kernel_install(False)
      File "C:\Users\Zachary\AppData\Local\Temp\pip-build-dx_wvbg0\vpnotebook\vpnotebook\__init__.py", line 63, in run_kernel_install
        install_kernel_spec(source_dir, kernel_name='vpython', user=user)
    NameError: free variable 'install_kernel_spec' referenced before assignment in enclosing scope

    ----------------------------------------
Command "c:\users\zachary\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Zachary\\AppData\\Local\\Temp\\pip-build-dx_wvbg0\\vpnotebook\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Zachary\AppData\Local\Temp\pip-3q5u2e2l-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Zachary\AppData\Local\Temp\pip-build-dx_wvbg0\vpnotebook\

Tags: installpippybuildliblocalkernelusers
3条回答

最直接的解决方法是在安装vpnotebook之前安装jupyter:

pip install jupyter

感谢您报告这一点;以后的问题发布在@user1114907指定的位置或github主存储库:https://github.com/BruceSherwood/vpython-jupyter/issues

这似乎是vpnotebook中的一个bug,它依赖于vpython。尝试在Python2.7和3.5中安装vpnotebook失败,并出现相同的错误,这似乎是由于包的作者甚至没有使用基本的linter造成的。我建议将此报告给上述作者,但是there are no contact details, repositories, or project websites listed on the package's PyPI page。在

如果您的python版本高于2.7.9,请跳到步骤3

  1. 安装python>;2.7.9[2.7.14是最新版本]

    • 下载最新版本的python
    • 提取档案
    • ./configure
    • make
    • make install
  2. 下载并重新安装pip

    • ^{cd4}
    • sudo python get-pip.py
  3. 先安装jupyter

    • sudo pip install jupyter
  4. 然后,安装vpython

    • sudo pip install vpython

Post-installation Screenshot

相关问题 更多 >