开发者问题收集

更新 Python 加密会导致错误并且脚本不起作用

2019-08-14
9990

我正在尝试更新Python密码学,但是发生错误的错误,我几乎不允许我运行任何脚本

我尝试了不同的方法来更新它,但它仍然从我的Linux PC“ Ubuntu” 32bits中发生。

722986143

他尝试更新它,因为每次运行一系列脚本时,他都会向我展示一个错误在运行脚本时:

155556493

我尝试尝试此

$ apt-get - auto-remove remove remove remove python-opensl

尝试命令

$ pip安装pyopenssl

返回以下错误:

514173043

i然后尝试使用

$ sudo apt install - reinstall python-openssl

错误仍会发生。

798720202

我发现您也可以尝试

$ sudo sudo easy_install -u cffi $ sudo easy_install -u加密

,但它不起作用

448972518 261162225
2个回答

您正在使用 sudo 修改系统 python 安装。这很危险,您可能已经修改了系统所依赖的库。请改用 virtualenv virtualenvwrapper

以下是使用 python2 的 virtualenvwrapper 运行情况:

brew@ontario:~$ mkvirtualenv -p `which python2` crypto2
Running virtualenv with interpreter /usr/local/bin/python2
New python executable in /Users/brew/.virtualenvs/crypto2/bin/python2.7
Also creating executable in /Users/brew/.virtualenvs/crypto2/bin/python
Installing setuptools, pip, wheel...
done.
virtualenvwrapper.user_scripts creating /Users/brew/.virtualenvs/crypto2/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/brew/.virtualenvs/crypto2/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/brew/.virtualenvs/crypto2/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/brew/.virtualenvs/crypto2/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/brew/.virtualenvs/crypto2/bin/get_env_details
(crypto2) brew@ontario:~$ pip install --upgrade pip
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already up-to-date: pip in ./.virtualenvs/crypto2/lib/python2.7/site-packages (19.2.2)
(crypto2) brew@ontario:~$ pip install cryptography
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting cryptography
  Downloading https://files.pythonhosted.org/packages/e2/bf/3b641820c561aedde134e88528ba68dffe41ed238899fab7f7ef20118aaf/cryptography-2.7-cp27-cp27m-macosx_10_6_intel.whl (1.6MB)
     |################################| 1.6MB 896kB/s
Collecting enum34; python_version < "3" (from cryptography)
  Using cached https://files.pythonhosted.org/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl
Collecting cffi!=1.11.3,>=1.8 (from cryptography)
  Downloading https://files.pythonhosted.org/packages/16/f6/46a3dece43541b2cbf3776ec2299e370a2408d9380958401cacb6d101853/cffi-1.12.3-cp27-cp27m-macosx_10_6_intel.whl (245kB)
     |################################| 256kB 6.6MB/s
Collecting six>=1.4.1 (from cryptography)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting asn1crypto>=0.21.0 (from cryptography)
  Using cached https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl
Collecting ipaddress; python_version < "3" (from cryptography)
  Downloading https://files.pythonhosted.org/packages/fc/d0/7fc3a811e011d4b388be48a0e381db8d990042df54aa4ef4599a31d39853/ipaddress-1.0.22-py2.py3-none-any.whl
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography)
Installing collected packages: enum34, pycparser, cffi, six, asn1crypto, ipaddress, cryptography
Successfully installed asn1crypto-0.24.0 cffi-1.12.3 cryptography-2.7 enum34-1.1.6 ipaddress-1.0.22 pycparser-2.19 six-1.12.0
(crypto2) brew@ontario:~$ deactivate
brew@ontario:~$ 

使用 python3 时也是一样:

brew@ontario:~$ mkvirtualenv -p `which python3` crypto3
Running virtualenv with interpreter /usr/local/bin/python3
Using base prefix '/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7'
New python executable in /Users/brew/.virtualenvs/crypto3/bin/python3.7
Also creating executable in /Users/brew/.virtualenvs/crypto3/bin/python
Installing setuptools, pip, wheel...
done.
virtualenvwrapper.user_scripts creating /Users/brew/.virtualenvs/crypto3/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/brew/.virtualenvs/crypto3/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/brew/.virtualenvs/crypto3/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/brew/.virtualenvs/crypto3/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/brew/.virtualenvs/crypto3/bin/get_env_details
(crypto3) brew@ontario:~$ pip install --upgrade pip
Requirement already up-to-date: pip in ./.virtualenvs/crypto3/lib/python3.7/site-packages (19.2.2)
(crypto3) brew@ontario:~$ pip install cryptography
Collecting cryptography
  Using cached https://files.pythonhosted.org/packages/63/4e/57b7a6bd98906872fcd2531e74b532de2abe17d675a5cf171931fcb4a9e8/cryptography-2.7-cp34-abi3-macosx_10_6_intel.whl
Collecting six>=1.4.1 (from cryptography)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting cffi!=1.11.3,>=1.8 (from cryptography)
  Using cached https://files.pythonhosted.org/packages/f0/48/5aa4ea664eba26dd5142558d04762f5065c02220b4665b3f7eecb9bb614e/cffi-1.12.3-cp37-cp37m-macosx_10_9_x86_64.whl
Collecting asn1crypto>=0.21.0 (from cryptography)
  Using cached https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography)
Installing collected packages: six, pycparser, cffi, asn1crypto, cryptography
Successfully installed asn1crypto-0.24.0 cffi-1.12.3 cryptography-2.7 pycparser-2.19 six-1.12.0
(crypto3) brew@ontario:~$ deactivate 
brew@ontario:~$ 
rriehle
2019-08-14

尝试

apt-get --auto-remove remove python-openssl

然后尝试 pip install pyopenSSL

lollerskates
2019-08-14