pyinstaller + pymongo 没有工作

pyinstaller + pymongo no worked

您好,pyinstaller 后我的程序无法运行

  File "main.py", line 16, in <module>
  File "pymongo\mongo_client.py", line 677, in __init__
  File "pymongo\uri_parser.py", line 532, in parse_uri
  File "pymongo\srv_resolver.py", line 119, in get_hosts
  File "pymongo\srv_resolver.py", line 102, in _get_srv_response_and_hosts
  File "pymongo\srv_resolver.py", line 103, in <listcomp>
AttributeError: 'GenericRdata' object has no attribute 'target'
[19304] Failed to execute script 'main' due to unhandled exception!```

我解决了我使用旧版本连接的问题 client = pymongo.MongoClient("mongodb://<login>:<mypassword> @cluster0-shard-00-00.492oe.mongodb.net:27017,cluster0-shard-00-01.492oe.mongodb.net:27017,cluster0-shard-00-02.492oe.mongodb.net:27017/<dbname>?ssl=true&replicaSet=atlas-qo0xpf-shard-0&authSource=admin&retryWrites=true&w=majority")

  • 添加标志 --hidden-import dns | 示例:“pyinstaller -F --hidden-import dns main.py”