当前位置: 首页 > news >正文

网站设计类论文怎么做宿州市网站建设有哪些公司

网站设计类论文怎么做,宿州市网站建设有哪些公司,中国十大电商平台排名,北京网站优化哪家好发布Flask Web项目时,报错缺少Cryptography,于是尝试重新安装该库,但本机没有网络,只支持手动离线安装,尝试了pip、setup.py两种方式安装,结果都报错。。最后使用将安装包拷贝至本机(在其他电脑上安装的sit…

发布Flask Web项目时,报错缺少Cryptography,于是尝试重新安装该库,但本机没有网络,只支持手动离线安装,尝试了pip、setup.py两种方式安装,结果都报错。。最后使用将安装包拷贝至本机(在其他电脑上安装的sitepackages里面的文件),重启后发现可以读取到该库

报错:RuntimeErrorRuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methodsTraceback (most recent call last)·         File "E:\software\python\lib\site-packages\flask\app.py", line 2213, in __call__return self.wsgi_app(environ, start_response)·         File "E:\software\python\lib\site-packages\flask\app.py", line 2193, in wsgi_appresponse = self.handle_exception(e)·         File "E:\software\python\lib\site-packages\flask\app.py", line 2190, in wsgi_appresponse = self.full_dispatch_request()·         File "E:\software\python\lib\site-packages\flask\app.py", line 1486, in full_dispatch_requestrv = self.handle_user_exception(e)·         File "E:\software\python\lib\site-packages\flask\app.py", line 1484, in full_dispatch_requestrv = self.dispatch_request()·         File "E:\software\python\lib\site-packages\flask\app.py", line 1469, in dispatch_requestreturn self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)·         File "E:\projects\WEB\HR_DL_DATA\hrproject\hrproject\V0809.01\app.py", line 7, in my_echartconn1, cur1 = utils.get_conn()·         File "E:\projects\WEB\HR_DL_DATA\hrproject\hrproject\V0809.01\utils.py", line 8, in get_connconn = pymysql.connect(host='127.0.0.1',·         File "E:\software\python\lib\site-packages\pymysql\connections.py", line 352, in __init__self.connect()·         File "E:\software\python\lib\site-packages\pymysql\connections.py", line 636, in connectself._request_authentication()·         File "E:\software\python\lib\site-packages\pymysql\connections.py", line 933, in _request_authenticationauth_packet = _auth.caching_sha2_password_auth(self, auth_packet)·         File "E:\software\python\lib\site-packages\pymysql\_auth.py", line 265, in caching_sha2_password_authdata = sha2_rsa_encrypt(conn.password, conn.salt, conn.server_public_key)·         File "E:\software\python\lib\site-packages\pymysql\_auth.py", line 143, in sha2_rsa_encryptraise RuntimeError(RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methodsThe debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:·   dump() shows all variables in the frame·   dump(obj) dumps all that's known about the object

这个报错提示是由于在您的项目中使用了 pymysql 库,而该库需要依赖 cryptography 来支持 sha256_passwordcaching_sha2_password 身份验证方法。由于您当前的环境中缺少 cryptography 包,所以导致了这个报错。

为了解决这个问题,您可以考虑以下几种方法:

  1. 手动安装 cryptography 包: 尝试手动从源代码构建并安装 cryptography 包,如前面所述。这将为 pymysql 提供所需的支持。

  2. 尝试其他 MySQL 连接库: 如果您只是为了连接 MySQL 数据库,您也可以尝试使用其他的 MySQL 连接库,例如 mysql-connector-python,它可能不需要 cryptography 依赖。

  3. 等待更新: 如前所述,您也可以等待 cryptography 更新并发布适用于您的配置的版本。

无论您选择哪种方法,都需要确保您的项目中安装了所需的依赖库,并且根据需要更新或调整代码以适应新的库版本。

cryptography需要单独安装吗?

是的,cryptography 包需要单独安装。它不是Python的内置标准库,因此需要使用 pip 命令来安装。

您可以使用以下命令来安装 cryptography 包:

pip install cryptography

安装完成后,您的项目应该就能够正常使用 pymysql 库并支持 sha256_passwordcaching_sha2_password 身份验证方法了。这将解决您之前报错的问题。

如果您没有网络连接,无法直接使用 pip 安装 cryptography 包,您可以从另一台有网络连接的计算机上下载 cryptography 包的安装文件(whl 文件),然后将其传输到您的目标计算机进行安装。

以下是具体步骤:

  1. 在有网络连接的计算机上,使用以下命令下载 cryptography 包的安装文件:
pip download cryptography
  1. 这将会下载 cryptography 包及其依赖的安装文件到当前目录。将下载得到的 .whl 文件复制到您的目标计算机上。

  2. 在目标计算机上,使用以下命令进行安装(假设您将 .whl 文件放在了同一个文件夹内):

pip install cryptography-3.3.2-cp36-abi3-win_amd64.whl

请注意,上述命令中的 .whl 文件名可能与您下载的文件名略有不同,您需要根据实际文件名进行调整。

通过这种方式,您可以将 cryptography 包的安装文件从有网络连接的计算机传输到目标计算机上,从而在没有网络连接的情况下进行安装。

我能直接把cryptography、cryptography-3.3.2.dist-info复制到sitepackages吗?

是的,您可以尝试将 cryptography 包及其相关的 .dist-info 文件夹复制到 Python 的 site-packages 目录中。这种方法有时可以在没有网络连接的情况下手动安装包。

请按照以下步骤操作:

  1. 从另一台有网络连接的计算机上下载 cryptography 包的 .whl 安装文件和 .dist-info 文件夹。确保您下载的是适用于您的 Python 版本和操作系统的版本。

  2. 将这些文件复制到目标计算机上。您可以将 cryptography 包的 .whl 文件和 .dist-info 文件夹一起复制到目标计算机上的 Python 的 site-packages 目录中。

  3. 打开命令行窗口,并导航到 Python 安装目录的 Scripts 文件夹中(例如:E:\software\python\Scripts)。

  4. 在命令行中运行以下命令来重新生成安装包的元数据缓存:

    python -m ensurepip
    
  5. 然后,尝试在命令行中运行您的应用程序,看看是否成功解决了报错问题。

请注意,尽管这种方法在某些情况下可能有效,但由于包的版本和依赖性问题,可能并不总是适用。在没有网络连接的情况下手动安装包时,请务必备份好您的现有环境,以防止出现意外问题。

如果这些步骤无法解决问题,可能需要尝试其他方法或在有网络连接的环境中进行操作。

我拷贝了cryptography 包及其相关的 .dist-info 文件夹复制到 Python 的 site-packages 目录中,发现还是读取不到这个包

如果您将cryptography包及其相关的.dist-info文件夹复制到了Python的site-packages目录中,但仍然无法读取该包,您可以尝试以下步骤:

  1. 确保您已经将cryptography包及其.dist-info文件夹复制到了正确的site-packages目录下。您可以通过运行以下命令来查找Python的site-packages路径:

    python -m site
    

    在输出中查找USER_SITEENABLE_USER_SITE行,以确定site-packages的路径。

  2. 确保复制的文件具有正确的权限。有时,文件权限问题可能会影响包的加载。您可以尝试使用管理员权限复制文件,或者确保复制的文件具有与其他包相同的权限。

  3. 确保您的Python解释器版本与您从其他计算机下载的cryptography包的版本相匹配。如果版本不匹配,可能会出现问题。

  4. 在将文件复制到site-packages目录后,尝试重新生成安装包的元数据缓存。在命令行中运行以下命令:

    python -m ensurepip
    
  5. 重新启动您的Python解释器,然后尝试导入cryptography包并运行您的应用程序。

如果您仍然无法解决问题,可能需要考虑其他解决方法,例如尝试使用其他计算机进行安装并将生成的虚拟环境(包括site-packages目录)复制到您的目标计算机上。另外,您还可以考虑在有网络连接的环境中解决此问题,例如使用代理或移动到网络连接较好的地方进行操作。

重启了电脑可以读取到!!!

其他问题

怎么处理这个问题:Microsoft Windows [版本 10.0.17134.1]

© 2018 Microsoft Corporation。保留所有权利。

E:\software\python\Lib\site-packages\package\cr\cryptography-3.3.2>python setup.py install

E:\software\python\lib\site-packages\setuptools_init_.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.

!!

    ********************************************************************************Requirements should be satisfied by a PEP 517 installer.If you are using pip, you can try `pip install --use-pep517`.********************************************************************************

!!

dist.fetch_build_eggs(dist.setup_requires)

WARNING: The wheel package is not available.

running install

E:\software\python\lib\site-packages\setuptools_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.

!!

    ********************************************************************************Please avoid running ``setup.py`` directly.Instead, use pypa/build, pypa/installer, pypa/build orother standards-based tools.See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.********************************************************************************

!!

self.initialize_options()

E:\software\python\lib\site-packages\setuptools_distutils\cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.

!!

    ********************************************************************************Please avoid running ``setup.py`` and ``easy_install``.Instead, use pypa/build, pypa/installer, pypa/build orother standards-based tools.See https://github.com/pypa/setuptools/issues/917 for details.********************************************************************************

!!

self.initialize_options()

running bdist_egg

running egg_info

writing src\cryptography.egg-info\PKG-INFO

writing dependency_links to src\cryptography.egg-info\dependency_links.txt

writing requirements to src\cryptography.egg-info\requires.txt

writing top-level names to src\cryptography.egg-info\top_level.txt

reading manifest file ‘src\cryptography.egg-info\SOURCES.txt’

reading manifest template ‘MANIFEST.in’

no previously-included directories found matching ‘docs_build’

warning: no previously-included files found matching ‘vectors’

warning: no previously-included files matching ‘*’ found under directory ‘vectors’

warning: no previously-included files matching ‘*’ found under directory ‘.github’

warning: no previously-included files found matching ‘release.py’

warning: no previously-included files found matching ‘.coveragerc’

warning: no previously-included files found matching ‘codecov.yml’

warning: no previously-included files found matching ‘.readthedocs.yml’

warning: no previously-included files found matching ‘dev-requirements.txt’

warning: no previously-included files found matching ‘rtd-requirements.txt’

warning: no previously-included files found matching ‘tox.ini’

warning: no previously-included files matching ‘*’ found under directory ‘.zuul.d’

warning: no previously-included files matching ‘*’ found under directory ‘.zuul.playbooks’

adding license file ‘LICENSE’

adding license file ‘LICENSE.APACHE’

adding license file ‘LICENSE.BSD’

adding license file ‘LICENSE.PSF’

adding license file ‘AUTHORS.rst’

writing manifest file ‘src\cryptography.egg-info\SOURCES.txt’

installing library code to build\bdist.win-amd64\egg

running install_lib

running build_py

running build_ext

generating cffi module ‘build\temp.win-amd64-cpython-310\Release\_padding.c’

already up-to-date

generating cffi module ‘build\temp.win-amd64-cpython-310\Release\_openssl.c’

already up-to-date

building ‘_openssl’ extension

=============================DEBUG ASSISTANCE=============================If you are seeing a compilation error please try the following steps tosuccessfully install cryptography:1) Upgrade to the latest pip and try again. This will fix errors for mostusers. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip2) Read https://cryptography.io/en/latest/installation.html for specificinstructions for your platform.3) Check our frequently asked questions for more information:https://cryptography.io/en/latest/faq.html=============================DEBUG ASSISTANCE=============================

error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: https://visualstudio.microsoft.com/visual-cpp-build-tools/

E:\software\python\Lib\site-packages\package\cr\cryptography-3.3.2>

解决办法

问题出在你缺少 Microsoft Visual C++ 14.0 或更高版本的编译工具,这是安装 cryptography 包时出现的错误。为了解决这个问题,你需要安装 Microsoft C++ Build Tools。你可以按照以下步骤进行操作:

  1. 访问链接 https://visualstudio.microsoft.com/visual-cpp-build-tools/,下载并安装 Microsoft Visual C++ 14.0 或更高版本的编译工具。这将为你提供所需的编译环境,使得安装 cryptography 包时能够成功编译相关的 C 扩展。

  2. 安装完成后,重新运行你的安装命令。你可以使用 pip 命令代替 python setup.py install 进行安装,同时添加 --use-pep517 参数,以启用 PEP 517 安装程序:

    pip install . --use-pep517
    
  3. 如果上述步骤无法解决问题,你可以尝试执行以下操作:

    • 确保你的 Python 环境和安装的包是兼容的,例如确保使用的是与 cryptography 包兼容的 Python 版本。
    • 更新你的 pip 版本到最新版本:pip install --upgrade pip
    • 阅读 cryptography 包的官方安装文档,以获取针对你的操作系统和环境的具体安装指导:https://cryptography.io/en/latest/installation.html。

如果你仍然遇到问题,可以尝试在官方文档中提到的“DEBUG ASSISTANCE”部分提供的调试步骤,这可能会帮助你进一步解决安装问题。
在这里插入图片描述

http://www.yayakq.cn/news/857532/

相关文章:

  • 向自己做网站徐州网站制作系统
  • 河南省住房城乡建设厅网站公众号开发板如何绑定视频号
  • 网站制作业务二次开发创造作用
  • 事业单位建立网站北京建设协会网站首页
  • 做网站可以用什么语言网站代码查看
  • 做响应式网站兼容哪几个尺寸高新区微网站建设
  • 网站设计开发文档模板下载网站管理员可控的关键节点
  • 太原北京网站建设公司哪家好免费中文网页模板
  • 我的世界做图片的网站东莞营销型网站建设找火速
  • 合肥网站建设创优涞水县住房和城乡建设局网站
  • 雅江网站建设网站开发 flex
  • 如何将网站开发成微信小程序国外设计网站怎么登陆
  • 大名网站建设费用简单的网站
  • 做网站主页上主要放哪些内容承接网站建设
  • 动易官方网站做瑞士网站
  • 陕西省建设局网站wordpress新闻
  • 专业制作彩铃网站成都微信网站建设报价
  • 网页美工设计的要点分别是什么seo的主要内容
  • 学做网站和推广要多久微信小程序公众平台
  • 给网站写教案做课件一节课多少钱如何更新网站快照
  • 网页设计软件官网模板网站网站做联盟收入
  • 企业网站建设要点怎么建立一个网站及推广
  • wordpress add_theme_page手机网站怎么做SEO优化
  • 做seo要先做网站么wordpress做网站
  • 有哪些品牌做打底衫的网站学生处网站建设招标公告
  • 营销网站建设创意上海企业vi设计公司
  • 如何建立网站是什么网站备案期限
  • 视频解析网站广州手工活外发加工网
  • 故城网站建设vue做网站看不到htmI吗
  • 网站建设与网页制作案例wordpress 注销按钮