about
pycrypto安装
1. 首先升级你的pip
text
python -m pip install --upgrade pip
安装失败的情况及解决
情况1. 安装成功,但用不了 这种情况首先选择升级你的pip版本,然后卸载掉pycrypto,再重新安装,也就是终端执行下面几个命令:
text
# 1. 升级pip版本
python -m pip install --upgrade pip
# 2. 卸载掉之前的pycrypto
pip uninstall pycrypto -y
# 3. 再重新安装pycrypto
pip install pycrypto
情况2. 也升级了pip版本,然后重新安装之后,也是用不了 这么着你就找到pycrypto的安装目录,一般在你的Python解释器的安装目录下的lib/site-packages
中找到pycrypto
这个包(文件夹),将该包名由:
text
crypto --> Crypto
pycryptodome安装
1. 首先升级你的pip
text
python -m pip install --upgrade pip
安装失败的情况及解决
情况1. 安装成功,但用不了 这种情况首先选择升级你的pip版本,然后卸载掉pycryptodome,再重新安装,也就是终端执行下面几个命令:
text
# 1. 升级pip版本
python -m pip install --upgrade pip
# 2. 卸载掉之前的pycryptodome
pip uninstall pycryptodome -y
# 3. 再重新安装pycryptodome
pip install pycryptodome
cryptography
pip._vendor.pytoml.core.TomlError:
python3.8 + pip.18
现象是pip安装该模块报错:
bash
(venv) F:\PycharmProjects\register>pip install cryptography
Collecting cryptography
Using cached https://files.pythonhosted.org/packages/de/ba/0664727028b37e249e73879348cc46d45c5c1a2a2e81e8166462953c5755/cryptography-43.0.1.tar.gz
Exception:
Traceback (most recent call last):
File "F:\PycharmProjects\register\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\cli\base_command.py", line 179, in main
status = self.run(options, args)
File "F:\PycharmProjects\register\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\commands\install.py", line 315, in run
resolver.resolve(requirement_set)
File "F:\PycharmProjects\register\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\resolve.py", line 131, in resolve
self._resolve_one(requirement_set, req)
File "F:\PycharmProjects\register\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\resolve.py", line 294, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "F:\PycharmProjects\register\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\resolve.py", line 240, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(
File "F:\PycharmProjects\register\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\operations\prepare.py", line 349, in prepare_linked_requirement
abstract_dist.prep_for_dist(finder, self.build_isolation)
File "F:\PycharmProjects\register\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\operations\prepare.py", line 109, in prep_for_dist
self.req.load_pyproject_toml()
File "F:\PycharmProjects\register\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\req\req_install.py", line 485, in load_pyproject_toml
pep517_data = load_pyproject_toml(
File "F:\PycharmProjects\register\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\pyproject.py", line 66, in load_pyproject_toml
pp_toml = pytoml.load(f)
File "F:\PycharmProjects\register\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_vendor\pytoml\parser.py", line 11, in load
return loads(fin.read(), translate=translate, object_pairs_hook=object_pairs_hook, filename=getattr(fin, 'name', repr(fin)))
File "F:\PycharmProjects\register\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_vendor\pytoml\parser.py", line 24, in loads
ast = _p_toml(src, object_pairs_hook=object_pairs_hook)
File "F:\PycharmProjects\register\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_vendor\pytoml\parser.py", line 340, in _p_toml
s.expect_eof()
File "F:\PycharmProjects\register\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_vendor\pytoml\parser.py", line 125, in expect_eof
return self._expect(self.consume_eof())
File "F:\PycharmProjects\register\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_vendor\pytoml\parser.py", line 165, in _expect
raise TomlError('msg', self._pos[0], self._pos[1], self._filename)
pip._vendor.pytoml.core.TomlError: C:\Users\Administrator\AppData\Local\Temp\pip-install-0uq5kq6d\cryptography\pyproject.toml(172, 1): msg
问题原因是pip版本过低导致的,解决方案就是升级pip版本之后再重装即可.
bash
python -m pip install -U pip
pip install cryptography