无法使用pip安装python软件包,需要获取Microsoft Visual C ++ 14.0 [英] Unable to install python package with pip, getting Microsoft Visual C++ 14.0 is required

查看:93
本文介绍了无法使用pip安装python软件包,需要获取Microsoft Visual C ++ 14.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装 pyjks . 正在管理命令提示符下运行所有​​内容. 最初尝试安装pyjks的结果是:

I am trying to install pyjks. Am running everything in admin command prompt. Initial try to install pyjks resulted in this:

C:\WINDOWS\system32>pip install pyjks
Collecting pyjks
Collecting pycryptodome (from pyjks)
  Using cached https://files.pythonhosted.org/packages/82/bd/bd192c1314bde108a91295fbec02bc20a816330feb10273aa36d885004ab/pycryptodome-3.6.1-cp36-cp36m-win_amd64.whl
Collecting pyasn1-modules (from pyjks)
  Using cached https://files.pythonhosted.org/packages/e9/51/bcd96bf6231d4b2cc5e023c511bee86637ba375c44a6f9d1b4b7ad1ce4b9/pyasn1_modules-0.2.1-py2.py3-none-any.whl
Collecting pyasn1 (from pyjks)
  Using cached https://files.pythonhosted.org/packages/a0/70/2c27740f08e477499ce19eefe05dbcae6f19fdc49e9e82ce4768be0643b9/pyasn1-0.4.3-py2.py3-none-any.whl
Collecting twofish (from pyjks)
  Using cached https://files.pythonhosted.org/packages/82/b4/9eb026a8e62a04512435d3de25c93f7bda51c8b8c7991c1c0be70b5115a6/twofish-0.3.0.tar.gz
Collecting javaobj-py3 (from pyjks)
  Using cached https://files.pythonhosted.org/packages/6a/7d/1979d67bb8f6c5babb8dda0cb79d6d4663ef9a039c193b5adcc787a86285/javaobj_py3-0.2.4-py2.py3-none-any.whl
Installing collected packages: pycryptodome, pyasn1, pyasn1-modules, twofish, javaobj-py3, pyjks
  Running setup.py install for twofish ... error
    Complete output from command "c:\program files\python36\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\crrma\\AppData\\Local\\Temp\\pip-install-xlk00hde\\twofish\\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\crrma\AppData\Local\Temp\pip-record-5jn53157\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.6
    copying twofish.py -> build\lib.win-amd64-3.6
    running build_ext
    building '_twofish' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    ----------------------------------------
Command ""c:\program files\python36\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\crrma\\AppData\\Local\\Temp\\pip-install-xlk00hde\\twofish\\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\crrma\AppData\Local\Temp\pip-record-5jn53157\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\crrma\AppData\Local\Temp\pip-install-xlk00hde\twofish\

我从此处安装了Visual C ++ 14.0并尝试重新安装.但是有同样的错误.

I installed Visual C++ 14.0 from here and tried reinstalling. But got same error.

因此,如在

So as suggested in several comments on this page, I upgraded setuptools:

C:\WINDOWS\system32>pip install --upgrade setuptools
Collecting setuptools
  Using cached https://files.pythonhosted.org/packages/7f/e1/820d941153923aac1d49d7fc37e17b6e73bfbd2904959fffbad77900cf92/setuptools-39.2.0-py2.py3-none-any.whl
Installing collected packages: setuptools
  Found existing installation: setuptools 39.0.1
    Uninstalling setuptools-39.0.1:
      Successfully uninstalled setuptools-39.0.1
Successfully installed setuptools-39.2.0

但是仍然出现相同的错误.因此,如在同一页上所建议的那样,我从此处下载tar.gz并从中安装:

But still getting the same error. So as suggested on same page, I downloaded tar.gz from here and installed from it:

C:\Users\crrma\Downloads>pip install pyjks-17.1.1.tar.gz
Processing c:\users\crrma\downloads\pyjks-17.1.1.tar.gz
Requirement already satisfied: pyasn1 in c:\program files\python36\lib\site-packages (from pyjks==17.1.1) (0.4.3)
Requirement already satisfied: pyasn1_modules in c:\program files\python36\lib\site-packages (from pyjks==17.1.1) (0.2.1)
Collecting javaobj-py3 (from pyjks==17.1.1)
  Using cached https://files.pythonhosted.org/packages/6a/7d/1979d67bb8f6c5babb8dda0cb79d6d4663ef9a039c193b5adcc787a86285/javaobj_py3-0.2.4-py2.py3-none-any.whl
Requirement already satisfied: pycryptodome in c:\program files\python36\lib\site-packages (from pyjks==17.1.1) (3.6.1)
Collecting twofish (from pyjks==17.1.1)
  Using cached https://files.pythonhosted.org/packages/82/b4/9eb026a8e62a04512435d3de25c93f7bda51c8b8c7991c1c0be70b5115a6/twofish-0.3.0.tar.gz
Installing collected packages: javaobj-py3, twofish, pyjks
  Running setup.py install for twofish ... error
    Complete output from command "c:\program files\python36\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\crrma\\AppData\\Local\\Temp\\pip-install-c3n_0udc\\twofish\\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\crrma\AppData\Local\Temp\pip-record-tpgigq69\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.6
    copying twofish.py -> build\lib.win-amd64-3.6
    running build_ext
    building '_twofish' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    ----------------------------------------
Command ""c:\program files\python36\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\crrma\\AppData\\Local\\Temp\\pip-install-c3n_0udc\\twofish\\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\crrma\AppData\Local\Temp\pip-record-tpgigq69\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\crrma\AppData\Local\Temp\pip-install-c3n_0udc\twofish\

但是它根本没有安装.这里出什么事了?

But its simply not getting installed. Whats going wrong here?

我正在运行最新版本的python:

I am running latest version of python:

C:\>python
Python 3.6.6rc1 (v3.6.6rc1:1015e38be4, Jun 12 2018, 08:38:06) [MSC v.1900 64 bit (AMD64)] on win32

推荐答案

我无法解决此问题. (我尝试通过安装,但是并没有似乎我安装的是运行时而不是编译器,我们需要安装Visual Studio来安装编译器.我对运行Visual Studio的大型安装程序(仅安装单个python包)感到不舒服.)而是我诉诸于设置cygwin(比Visual Studio小,并且已经安装在我的计算机上).我尝试在cygwin终端上运行pip3 install pyjks,但是现在出现错误,提示找不到gcc.似乎pyjks的某些依赖项需要由C编译器进行编译.所以我在cygwin中安装了gcc.但是,它也失败了.所以我用apt-cyg安装了gcc.所有步骤都在下面说明.

I was not able to fix this up. (I tried by installing this, but it didnt work. It seems that what I installed is runtime but not the compiler and we need to install Visual Studio for installing compiler. I was not feeling great to run big setup of the Visual Studio just to install single python package.) Instead I resorted to setting up cygwin (which is small compared to Visual Studio and was already installed on my machine). I tried running pip3 install pyjks on cygwin terminal, but now it gave error saying it did not find gcc. It seems that somehow some dependencies of pyjks needs to be compiled by C compiler. So I installed gcc in cygwin. However it was also failing. So I installed gcc using apt-cyg. All the steps are explained below.

  1. 安装 cygwin
  2. 在cygwin设置中,在程序包选择窗口中选择python3,pip3和gcc-g ++程序包:

  1. Install cygwin
  2. In cygwin setup, select python3, pip3 and gcc-g++ packages in package selection window:

  • python3-devel:Py3K语言解释器
  • python3-pip:Python软件包安装工具
  • gcc-core:GNU编译器集合(C,OpenMP)
  • gcc-g ++:GNU编译器集合(C ++)

我无法通过上述方法安装gcc.它给了我以下错误:
因此,我尝试使用apt-cyg安装它.您可以在此答案中找到安装apt-cyg的步骤.一旦可以从cyg-win终端(即path-to-cygwin\cygwin\setup\Cygwin.bat)访问apt-cyg,则可以运行以下命令来安装gcc

I was not able to install gcc by above approach. It was giving me following error:
So I tried installing it using apt-cyg. You can find steps to install apt-cyg in this answer. Once apt-cyg is accessible from cyg-win terminal (that is, path-to-cygwin\cygwin\setup\Cygwin.bat), you can run following command to install gcc

apt-cyg install gcc-g++

  • 一旦安装了gcc,就可以使用pip安装pyjks(不会出现任何错误,提示未找到C编译器):

  • Once gcc is installed, you can install pyjks using pip (it will not give any error saying C compiler not found):

    pip3 install pyjks
    

  • 我什至可以将cygwin(即path-to-cygwin\cygwin\bin\python3)内的python指向Eclipse PyDev模块的python解释器.这也使我可以在python中使用os.fork(),因为Windows python的os模块不包含fork().

    I was even able to point python inside cygwin (that is, path-to-cygwin\cygwin\bin\python3) as python interpreter for eclipse PyDev module. This also allowed me to use os.fork() in python, since windows python's os module does not contain fork().

    这篇关于无法使用pip安装python软件包,需要获取Microsoft Visual C ++ 14.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆