python - python3如何自动安装模块?
问题描述
我尝试像这样安装所需的模块:
try:
import pyAesCrypt
print('package: pyAesCrypt found')
except:
mod_inst = subprocess.Popen("pip3 install pyAesCrypt", shell=True)
mod_inst.wait()
import pyAesCrypt
print('package: ' + package + ' installed')
结果我收到以下错误,如何使我的代码工作?
Collecting pyAesCrypt
Using cached https://files.pythonhosted.org/packages/c5/99/ebae89da08a443d0191eff631d66b71955eec7e370e2a309d85e499ca18a/pyAesCrypt-0.4.3-py3-none-any.whl
Requirement already satisfied: cryptography in /usr/lib/python3/dist-packages (from pyAesCrypt) (2.6.1)
Installing collected packages: pyAesCrypt
Successfully installed pyAesCrypt-0.4.3
Traceback (most recent call last):
File "smb.py", line 6, in <module>
import pyAesCrypt
ModuleNotFoundError: No module named 'pyAesCrypt'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "smb.py", line 13, in <module>
import pyAesCrypt
ModuleNotFoundError: No module named 'pyAesCrypt'
解决方案
你有多个 python 版本吗?
推荐阅读
- amazon-web-services - AWS Batch 中的 Docker 上的 AWS S3 挂载
- python - scipy io.mmwrite 函数避免使用科学记数法
- reactjs - 是否可以多次使用相同的 prop 标签向 React 组件添加数据,然后让组件将该数据映射到列表项中?
- ssl - 删除 Kubernetes 中的 SSL 证书
- parsing - 启动服务器时出现 %PARSER_ERROR
- r - 我正在尝试对 1 列中的 900,00+ 行进行统计分析。我有几个问题
- flutter - 根据指定的另一个时间及其时区获取日期和时间[颤振]
- reactjs - 仅在生产时在 gatsby 的动态路由中重新加载页面时得到 404
- vue.js - 如何将查询参数绑定到命名路由器视图
- android - 长按选择recyclerview项目