环境:conda python3.10 系统:M1 Mac
输入: pipreqs /Users///fastapi_llama --force pipreqs ./ --encoding=utf8
报错信息: ERROR: Failed on file: ./.conda/lib/python3.1/lib2to3/tests/data/different_encoding.py Traceback (most recent call last): File "/opt/anaconda3/envs/ai_project/bin/pipreqs", line 8, in <module> sys.exit(main()) File "/opt/anaconda3/envs/ai_project/lib/python3.10/site-packages/pipreqs/pipreqs.py", line 609, in main init(args) File "/opt/anaconda3/envs/ai_project/lib/python3.10/site-packages/pipreqs/pipreqs.py", line 533, in init candidates = get_all_imports( File "/opt/anaconda3/envs/ai_project/lib/python3.10/site-packages/pipreqs/pipreqs.py", line 153, in get_all_imports raise exc File "/opt/anaconda3/envs/ai_project/lib/python3.10/site-packages/pipreqs/pipreqs.py", line 139, in get_all_imports tree = ast.parse(contents) File "/opt/anaconda3/envs/ai_project/lib/python3.10/ast.py", line 50, in parse return compile(source, filename, mode, flags, File "<unknown>", line 3 print u'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
然后我点开 ./.conda/lib/python3.1/lib2to3/tests/data/different_encoding.py 发现这里面就是乱码: #!/usr/bin/env python print u'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ'
def f(x): print '%s\t-> α(%2i):%s β(%s)'
我的问题: 1.无法使用 pipreqs ,有什么解决的办法? 前几天还是用这个导出的 翻了部分 issue 和 google 都没得到解决,所以发帖请教
1
Latin 205 天前
|
3
Hamao OP 但是我还是很好奇上面错误的逻辑😂
|
4
noahlias 205 天前
看情况你用到了 python2 ?这貌似是你的代码问题
不过不对啊 为啥你会去找 conda 下的 python3.1 ? 似乎是你的 conda 配置问题 |
5
noahlias 205 天前
|
6
Hamao OP 感谢 帮忙找到一个 issue ,但是 我目前的版本已经是 24 年最新的了,感觉还是我环境太乱了 我再研究一下
|