老古董CentOS release 6.10升级Python2.7.15到Python3.9.17后出现的一些问题处理记录
操作系统版本:
cat /etc/redhat-release
CentOS release 6.10 (Final)
默认python版本:
python2 -V
Python 2.7.15
copying src/cryptography/hazmat/bindings/_rust/openssl/x448.pyi -> build/lib.linux-x86_64-cpython-39/cryptography/hazmat/bindings/_rust/openssl
running build_ext
running build_rust
=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install cryptography:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Read https://cryptography.io/en/latest/installation/ for specific
instructions for your platform.
3) Check our frequently asked questions for more information:
https://cryptography.io/en/latest/faq/
4) Ensure you have a recent Rust toolchain installed:
https://cryptography.io/en/latest/installation/#rust
Python: 3.9.17
platform: Linux-2.6.32-754.6.3.el6.x86_64-x86_64-with-glibc2.12
pip: n/a
setuptools: 68.1.2
setuptools_rust: 1.6.0
rustc: n/a
=============================DEBUG ASSISTANCE=============================
error: can't find Rust compiler
If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
To update pip, run:
pip install --upgrade pip
and then retry package installation.
If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
This package requires Rust >=1.56.0.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cryptography
解决方法:
#尝试升级pip
pip install --upgrade pip
#编译解决
pip install cryptography --only-binary :all:
ModuleNotFoundError: No module named '_ctypes'的报错问题处理
yum install libffi-devel -y
重新编译python源码即可。
ModuleNotFoundError: No module named setuptools_rust的报错问题处理
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-build-my9sai1o/cryptography/setup.py”, line 14, in
from setuptools_rust import RustExtension
ModuleNotFoundError: No module named ‘setuptools_rust’
Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-my9sai1o/cryptography/
解决:
pip3 install -U pip setuptools
pip3 报错 distribution was not found and is required by the application 处理:
#用which pip3找到位置
which pip3
/usr/local/bin/pip3
#修改其中的版本号保存后即可使用pip3:
vi /usr/local/bin/pip3
#!/usr/local/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==18.0','console_scripts','pip3'
__requires__ = 'pip==23.2.1'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('pip==23.2.1', 'console_scripts', 'pip3')()
)
升级后的Python3版本:
python
Python 3.9.17 (main, Aug 22 2023, 14:44:04)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux
Type "help", "copyright", "credits" or "license" for more information.
吐槽下阿里云的短信服务SDK没有腾讯云的好用。
https://next.api.aliyun.com/api-tools/sdk/Dysmsapi?version=2017-05-25&language=python-tea&tab=primer-doc
Tag标签:「python 升级 古董」更新时间:「2023-08-22 15:28:42」阅读次数:「2007」