我正在尝试安装pyjks。 我在管理命令提示符下运行一切。 最初尝试安装pyjks导致了这个:
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\
我从here安装了Visual C ++ 14.0并尝试重新安装。但是得到了同样的错误。
正如在this page的几条评论中所建议的那样,我升级了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
但仍然得到同样的错误。正如same page所建议的那样,我从here下载了tar.gz并从中安装:
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\
但它根本没有安装。这里出了什么问题?
我正在运行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
答案 0 :(得分:0)
我无法解决此问题。 (我尝试通过安装this进行尝试,但没有成功。似乎我安装的是运行时而不是编译器,我们需要安装Visual Studio来安装编译器。我对运行大型安装程序感到不舒服Visual Studio只是安装单个python包。)相反,我诉诸于设置cygwin(与Visual Studio相比,它很小,并且已经安装在我的计算机上)。我尝试在cygwin终端上运行pip3 install pyjks
,但是现在出现错误,提示找不到gcc。看来pyjks
的某些依赖项需要由C编译器进行编译。所以我在cygwin中安装了gcc。但是它也失败了。因此,我使用apt-cyg
安装了gcc。所有步骤都在下面说明。
在cygwin设置中,在软件包选择窗口中选择python3,pip3和gcc-g ++软件包:
path-to-cygwin\cygwin\setup\setup-x86_64.exe
)并选择以上软件包。 我无法通过上述方法安装gcc。它给了我以下错误:
因此,我尝试使用apt-cyg
安装它。您可以在this answer中找到安装apt-cyg
的步骤。从apt-cyg
终端(即cyg-win
)访问path-to-cygwin\cygwin\setup\Cygwin.bat
后,您可以运行以下命令来安装gcc
apt-cyg install gcc-g++
一旦安装了gcc,就可以使用pyjks
安装pip
(不会出现任何错误,提示未找到C编译器):
pip3 install pyjks
我什至可以将cygwin(即path-to-cygwin\cygwin\bin\python3
)内的python指向eclipse PyDev模块的python解释器。这也使我可以在python中使用os.fork()
,因为Windows python的os
模块不包含fork()
。