python加密安装方法_安装Python加密

当运行pip install cryptography时,我得到以下结果pip install cryptography

Downloading/unpacking cryptography

Running setup.py egg_info for package cryptography

Traceback (most recent call last):

File "", line 16, in

File "/tmp/pip-build-root/cryptography/setup.py", line 174, in

"test": PyTest,

File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup

dist.run_commands()

File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands

self.run_command(cmd)

File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command

cmd_obj.run()

File "", line 14, in replacement_run

File "/usr/lib/python2.6/site-packages/setuptools/command/egg_info.py", line 254, in find_sources

mm.run()

File "/usr/lib/python2.6/site-packages/setuptools/command/egg_info.py", line 308, in run

self.add_defaults()

File "/usr/lib/python2.6/site-packages/setuptools/command/egg_info.py", line 332, in add_defaults

sdist.add_defaults(self)

File "/usr/lib/python2.6/site-packages/setuptools/command/sdist.py", line 187, in add_defaults

build_py = self.get_finalized_command('build_py')

File "/usr/lib64/python2.6/distutils/cmd.py", line 319, in get_finalized_command

cmd_obj.ensure_finalized()

File "/usr/lib64/python2.6/distutils/cmd.py", line 117, in ensure_finalized

self.finalize_options()

File "/usr/lib/python2.6/site-packages/setuptools/command/build_py.py", line 61, in finalize_options

_build_py.finalize_options(self)

File "/usr/lib64/python2.6/distutils/command/build_py.py", line 50, in finalize_options

('force', 'force'))

File "/usr/lib64/python2.6/distutils/cmd.py", line 305, in set_undefined_options

src_cmd_obj.ensure_finalized()

File "/usr/lib64/python2.6/distutils/cmd.py", line 117, in ensure_finalized

self.finalize_options()

File "/tmp/pip-build-root/cryptography/setup.py", line 88, in finalize_options

self.distribution.ext_modules = get_ext_modules()

File "/tmp/pip-build-root/cryptography/setup.py", line 65, in get_ext_modules

from cryptography.hazmat.primitives import constant_time, padding

File "cryptography/hazmat/primitives/constant_time.py", line 49, in

_ffi = cffi.FFI()

File "/tmp/pip-build-root/cryptography/cffi-0.8.6-py2.6-linux-x86_64.egg/cffi/api.py", line 56, in __init__

import _cffi_backend as backend

ImportError: /tmp/pip-build-root/cryptography/cffi-0.8.6-py2.6-linux-x86_64.egg/_cffi_backend.so: failed to map segment from shared object: Operation not permitted

Complete output from command python setup.py egg_info:

running egg_info

writing requirements to pip-egg-info/cryptography.egg-info/requires.txt

writing pip-egg-info/cryptography.egg-info/PKG-INFO

writing top-level names to pip-egg-info/cryptography.egg-info/top_level.txt

writing dependency_links to pip-egg-info/cryptography.egg-info/dependency_links.txt

warning: manifest_maker: standard file '-c' not found

Traceback (most recent call last):

File "", line 16, in

File "/tmp/pip-build-root/cryptography/setup.py", line 174, in

"test": PyTest,

File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup

dist.run_commands()

File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands

self.run_command(cmd)

File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command

cmd_obj.run()

File "", line 14, in replacement_run

File "/usr/lib/python2.6/site-packages/setuptools/command/egg_info.py", line 254, in find_sources

mm.run()

File "/usr/lib/python2.6/site-packages/setuptools/command/egg_info.py", line 308, in run

self.add_defaults()

File "/usr/lib/python2.6/site-packages/setuptools/command/egg_info.py", line 332, in add_defaults

sdist.add_defaults(self)

File "/usr/lib/python2.6/site-packages/setuptools/command/sdist.py", line 187, in add_defaults

build_py = self.get_finalized_command('build_py')

File "/usr/lib64/python2.6/distutils/cmd.py", line 319, in get_finalized_command

cmd_obj.ensure_finalized()

File "/usr/lib64/python2.6/distutils/cmd.py", line 117, in ensure_finalized

self.finalize_options()

File "/usr/lib/python2.6/site-packages/setuptools/command/build_py.py", line 61, in finalize_options

_build_py.finalize_options(self)

File "/usr/lib64/python2.6/distutils/command/build_py.py", line 50, in finalize_options

('force', 'force'))

File "/usr/lib64/python2.6/distutils/cmd.py", line 305, in set_undefined_options

src_cmd_obj.ensure_finalized()

File "/usr/lib64/python2.6/distutils/cmd.py", line 117, in ensure_finalized

self.finalize_options()

File "/tmp/pip-build-root/cryptography/setup.py", line 88, in finalize_options

self.distribution.ext_modules = get_ext_modules()

File "/tmp/pip-build-root/cryptography/setup.py", line 65, in get_ext_modules

from cryptography.hazmat.primitives import constant_time, padding

File "cryptography/hazmat/primitives/constant_time.py", line 49, in

_ffi = cffi.FFI()

File "/tmp/pip-build-root/cryptography/cffi-0.8.6-py2.6-linux-x86_64.egg/cffi/api.py", line 56, in __init__

import _cffi_backend as backend

ImportError: /tmp/pip-build-root/cryptography/cffi-0.8.6-py2.6-linux-x86_64.egg/_cffi_backend.so: failed to map segment from shared object: Operation not permitted

----------------------------------------

Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-root/cryptography

Storing complete log in /root/.pip/pip.log

我猜他们的一些依赖关系出了问题,我错过了?

当我运行sudo yum install gcc libffi-devel python-devel openssl-devel来安装所需的依赖项时,得到以下结果sudo yum install gcc libffi-devel python-devel openssl-devel

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: mirror.econdc.com

* epel: mirrors.coreix.net

* extras: centos.hyve.com

* updates: mirror.sov.uk.goscomb.net

Setting up Install Process

Package gcc-4.4.7-4.el6.x86_64 already installed and latest version

Package libffi-devel-3.0.5-3.2.el6.x86_64 already installed and latest version

Package python-devel-2.6.6-52.el6.x86_64 already installed and latest version

Package openssl-devel-1.0.1e-16.el6_5.15.x86_64 already installed and latest version

Nothing to do

有人对我缺少什么有什么建议吗?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在 Linux 下安装 PyConcrete 加密 Python 代码的步骤如下: 1. 安装 Pythonpip PyConcrete 是一个 Python 模块,因此需要安装 Pythonpip。在 Ubuntu 上,可以使用以下命令安装: ``` sudo apt update sudo apt install python3 python3-pip ``` 2. 安装 PyConcretee 使用 pip 安装 PyConcretee: ``` pip3 install pyconcrete ``` 3. 创建加密脚本 创建一个 Python 脚本,将要加密和保护。例如,我们可以创建一个名为 `my_script.py` 的文件,其中包含以下内容: ``` def my_function(): print("Hello, world!") if __name__ == '__main__': my_function() ``` 4. 创建加密配置文件 创建一个名为 `pyconcrete.cfg` 的文件,并将以下内容添加到其中: ``` [pyconcrete] key = my_secret_key mode = encrypt ``` 其中,`key` 是一个用于加密和解密文件的密钥,`mode` 是指定 PyConcretee 运行模式的选项。在此示例中,我们将使用 `encrypt` 模式加密文件。 5. 加密脚本 使用 PyConcretee 加密脚本: ``` pyconcrete-tool.py encrypt my_script.py -c pyconcrete.cfg -o my_script_encrypted.py ``` 这将使用 `pyconcrete.cfg` 中指定的密钥和模式,将 `my_script.py` 文件加密,并将结果保存到 `my_script_encrypted.py` 文件中。 6. 运行加密脚本 使用 Python 运行加密脚本: ``` python3 my_script_encrypted.py ``` 这将运行已加密的 `my_script_encrypted.py` 文件,并输出 `Hello, world!`。 在以上步骤中,我们使用 PyConcretee 加密了一个 Python 脚本,并在 Linux 上运行了加密后的脚本。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值