到目前为止我已尝试过的步骤:
创建虚拟环境。
python3.4 -m venv [venv_name_here]
进入虚拟环境。
cd [venv_name_here]
激活虚拟环境。
source bin / activate
安装setuptools。
pip install --upgrade setuptools
安装pyparser。
pip install --upgrade pyparser
输出:
Downloading/unpacking pyparser
Downloading pyparser-1.0.tar.gz
Running setup.py (path:[path-to-venv]/build/pyparser/setup.py) egg_info for package pyparser
Downloading/unpacking parse==1.6.5 (from pyparser)
Downloading parse-1.6.5.tar.gz
Running setup.py (path:[path-to-venv]/build/parse/setup.py) egg_info for package parse
Installing collected packages: pyparser, parse
Running setup.py install for pyparser
Could not find .egg-info directory in install record for pyparser
Running setup.py install for parse
Could not find .egg-info directory in install record for parse==1.6.5 (from pyparser)
Successfully installed pyparser parse
Cleaning up..
安装cffi。
pip install --upgrade cffi
输出:
Downloading/unpacking cffi
Downloading cffi-1.11.5.tar.gz (438kB): 438kB downloaded
Running setup.py (path:[path-to-venv]/build/cffi/setup.py) egg_info for package cffi
Downloading/unpacking pycparser (from cffi)
Downloading pycparser-2.18.tar.gz (245kB): 245kB downloaded
Running setup.py (path:[path-to-venv]/build/pycparser/setup.py) egg_info for package pycparser
warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
warning: no previously-included files matching 'lextab.*' found under directory 'tests'
warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
warning: no previously-included files matching 'lextab.*' found under directory 'examples'
Installing collected packages: cffi, pycparser
Running setup.py install for cffi
building '_cffi_backend' extension
gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/local/lib/libffi-3.1/include -I[path-to-venv]/include -I/usr/local/include/python3.4m -c c/_cffi_backend.c -o build/temp.linux-i686-3.4/c/_cffi_backend.o
gcc -pthread -shared build/temp.linux-i686-3.4/c/_cffi_backend.o -L$(libdir) -lffi -o build/lib.linux-i686-3.4/_cffi_backend.cpython-34m.so
Could not find .egg-info directory in install record for cffi
Running setup.py install for pycparser
warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
warning: no previously-included files matching 'lextab.*' found under directory 'tests'
warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
warning: no previously-included files matching 'lextab.*' found under directory 'examples'
Build the lexing/parsing tables
Could not find .egg-info directory in install record for pycparser (from cffi)
Successfully installed cffi pycparser
Cleaning up...
安装加密。
pip install --upgrade cryptography
输出:
Downloading/unpacking cryptography
Downloading cryptography-2.2.2.tar.gz (443kB): 443kB downloaded
Running setup.py (path:[path-to-venv]/build/cryptography/setup.py) egg_info for package cryptography
no previously-included directories found matching 'docs/_build'
warning: no previously-included files matching '*' found under directory 'vectors'
Downloading/unpacking idna>=2.1 (from cryptography)
Downloading idna-2.6-py2.py3-none-any.whl (56kB): 56kB downloaded
Downloading/unpacking asn1crypto>=0.21.0 (from cryptography)
Downloading asn1crypto-0.24.0-py2.py3-none-any.whl (101kB): 101kB downloaded
Downloading/unpacking six>=1.4.1 (from cryptography)
Downloading six-1.11.0-py2.py3-none-any.whl
Installing collected packages: cryptography, idna, asn1crypto, six
Running setup.py install for cryptography
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "[path-to-venv]/build/cryptography/setup.py", line 319, in <module>
**keywords_with_side_effects(sys.argv)
File "[path-to-venv]/lib/python3.4/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/local/lib/python3.4/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "[path-to-venv]/lib/python3.4/site-packages/setuptools/dist.py", line 363, in __init__
_Distribution.__init__(self, attrs)
File "/usr/local/lib/python3.4/distutils/dist.py", line 280, in __init__
self.finalize_options()
File "[path-to-venv]/lib/python3.4/site-packages/setuptools/dist.py", line 519, in finalize_options
ep.load()(self, ep.name, value)
File "[path-to-venv]/lib/python3.4/site-packages/cffi/setuptools_ext.py", line 204, in cffi_modules
add_cffi_module(dist, cffi_module)
File "[path-to-venv]/lib/python3.4/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
execfile(build_file_name, mod_vars)
File "[path-to-venv]/lib/python3.4/site-packages/cffi/setuptools_ext.py", line 25, in execfile
exec(code, glob, glob)
File "src/_cffi_src/build_openssl.py", line 106, in <module>
extra_link_args=extra_link_args(compiler_type()),
File "[path-to-venv]/build/cryptography/src/_cffi_src/utils.py", line 49, in build_ffi_for_binding
extra_link_args=extra_link_args,
File "[path-to-venv]/build/cryptography/src/_cffi_src/utils.py", line 57, in build_ffi
ffi = FFI()
File "[path-to-venv]/lib/python3.4/site-packages/cffi/api.py", line 46, in __init__
import _cffi_backend as backend
ImportError: [path-to-venv]/lib/python3.4/site-packages/_cffi_backend.cpython-34m.so: undefined symbol: __syscall_error
Complete output from command [path-to-venv]/bin/python3.4 -c "import setuptools, tokenize;__file__='[path-to-venv]/build/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-pm4i20dg-record/install-record.txt --single-version-externally-managed --compile --install-headers [path-to-venv]/include/site/python3.4:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "[path-to-venv]/build/cryptography/setup.py", line 319, in <module>
**keywords_with_side_effects(sys.argv)
File "[path-to-venv]/lib/python3.4/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/local/lib/python3.4/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "[path-to-venv]/lib/python3.4/site-packages/setuptools/dist.py", line 363, in __init__
_Distribution.__init__(self, attrs)
File "/usr/local/lib/python3.4/distutils/dist.py", line 280, in __init__
self.finalize_options()
File "[path-to-venv]/lib/python3.4/site-packages/setuptools/dist.py", line 519, in finalize_options
ep.load()(self, ep.name, value)
File "[path-to-venv]/lib/python3.4/site-packages/cffi/setuptools_ext.py", line 204, in cffi_modules
add_cffi_module(dist, cffi_module)
File "[path-to-venv]/lib/python3.4/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
execfile(build_file_name, mod_vars)
File "[path-to-venv]/lib/python3.4/site-packages/cffi/setuptools_ext.py", line 25, in execfile
exec(code, glob, glob)
File "src/_cffi_src/build_openssl.py", line 106, in <module>
extra_link_args=extra_link_args(compiler_type()),
File "[path-to-venv]/build/cryptography/src/_cffi_src/utils.py", line 49, in build_ffi_for_binding
extra_link_args=extra_link_args,
File "[path-to-venv]/build/cryptography/src/_cffi_src/utils.py", line 57, in build_ffi
ffi = FFI()
File "[path-to-venv]/lib/python3.4/site-packages/cffi/api.py", line 46, in __init__
import _cffi_backend as backend
ImportError: [path-to-venv]/lib/python3.4/site-packages/_cffi_backend.cpython-34m.so: undefined symbol: __syscall_error
----------------------------------------
Cleaning up...
Command [path-to-venv]/bin/python3.4 -c "import setuptools, tokenize;__file__='[path-to-venv]/build/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-pm4i20dg-record/install-record.txt --single-version-externally-managed --compile --install-headers [path-to-venv]/include/site/python3.4 failed with error code 1 in [path-to-venv]/build/cryptography
Storing debug log for failure in /home/webdev/.pip/pip.log
这里发生了什么故障以及如何解决?
安装加密技术对于虚拟环境来说似乎是一件相对简单的事情,但它无法正常工作,我也没有在网上任何地方看到任何类似问题的引用。
更新:操作系统类型为Linux,加密安装在系统本身上运行正常。只有在尝试安装到虚拟环境中时才会出现此问题。
答案 0 :(得分:1)
对我来说使用 virtualenv
解决了这个问题
通过创建虚拟环境
python3 -m virtualenv venv
然后安装加密
pip install cryptography