问题标签 [six]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python-2.7 - 尽管安装了 pip,但导入六个模块不起作用
我正在构建一个网络应用程序(基于谷歌应用程序引擎和 python 2.7)并尝试导入 Six.move 模块。但是虽然安装了“六”,但是在导入的时候并没有找到(注意,我还没有使用Django之类的框架)。
在我的工作环境(env)中,我运行了:
调用此包的模块是“google.oauth2”中的“id_token.py”
所以,当我跑步时
然后加载我的网络应用程序,导入错误日志显示:
id_token.py 模块调用:
...导致上面的日志导入错误。
我的理解是,如果在我的环境(env)上,我可以看到安装了“六”,那么从我的应用程序导入这个模块应该没有问题。这在某种程度上不正确吗?
我一定错过了一些基本的东西,但不明白是什么?请帮忙!
PS:我也尝试过的资源:
A)甚至从我的“main.py”文件中调用:
导致相同的 ImportError。
B) ImportError: No module named 六
C) 未解决: 无法安装 python 六模块
python - AttributeError:“模块”对象没有六个库的属性“raise_from”
使用任务流(v2.7.0 和 v3.1.0)启动流 时出现以下错误:
然后我发现six.raise_from
/usr/lib/python2.7/site-packages/six.py 中也存在函数,
并使用 Python 交互式 shell 执行了一些命令:
似乎six.raise_from
工作正常,但我找不到发生上述错误的原因。有没有人帮助解决这个问题?
python-2.7 - ImportError:没有名为移动的模块
版本
- 蟒蛇:2.7.14
- 六:1.9.0 & 1.11.0(都试过了)
- 操作系统: mac(10.13.3) & ubuntu(16.04) [在两者上都试过]
错误
from Six.moves import http_client
ImportError: No module named moves
描述
在谷歌应用程序引擎上运行的烧瓶应用程序中,同时在本地系统上运行它,dev_appserver.py
在导入时使用出现上述错误from six.moves import http_client
我试过的
导入六个后尝试dir(six)
了其中显示moves
列表中有但无法导入它,这很奇怪。
输出six.__version__
:1.11.0
如果 dir(6) 则输出
['/opt/tribes-backend', '/opt/tribes-backend/lib1', '/usr/lib/google-cloud-sdk/platform/google_appengine', '/usr/lib/google-cloud-sdk/平台/google_appengine'、'/usr/lib/python2.7'、'/usr/lib/python2.7/lib-dynload'、'/usr/lib/google-cloud-sdk/platform/google_appengine/lib/ssl -2.7.11', '/usr/lib/google-cloud-sdk/platform/google_appengine/lib/grpcio-1.0.0', '/usr/lib/google-cloud-sdk/platform/google_appengine/lib/six -1.9.0', '/usr/lib/google-cloud-sdk/platform/google_appengine/lib/protobuf-3.0.0', '/usr/lib/google-cloud-sdk/platform/google_appengine/lib/enum -0.9.23', '/usr/lib/google-cloud-sdk/platform/google_appengine/lib/futures-3.0.5', '/usr/lib/google-cloud-sdk/platform/google_appengine/lib/setuptools -36.6.0', '/usr/lib/google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0', '/usr/lib/google-cloud-sdk/platform/google_appengine/lib/pytz-2017.2', '/usr/lib /google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3', '/usr/lib/google-cloud-sdk/platform/google_appengine/lib/webob-1.1.1', '/usr/lib/google -cloud-sdk/platform/google_appengine/lib/werkzeug-0.11.10','/usr/lib/google-cloud-sdk/platform/google_appengine/lib/yaml-3.10','/usr/local/lib/python2 .7/dist-packages/enum'、'/usr/lib/google-cloud-sdk/platform/google_appengine/lib/concurrent/concurrent'、'/usr/local/lib/python2.7/dist-packages/concurrent ', '/usr/local/lib/python2.7/dist-packages/google', '/usr/lib/google-cloud-sdk/platform/google_appengine/google'] ['BytesIO', 'Iterator', 'MAXSIZE', 'Module_six_moves_urllib', 'Module_six_moves_urllib_error', 'Module_six_moves_urllib_parse', 'Module_six_moves_urllib_request', 'Module_six_moves_urllib_response', 'Module_six_moves_urllib_robotparser', 'MovedAttribute', 'MovedModule', 'PY2', 'PY3', 'StringIO', '_LazyDescr' , '_LazyModule', '_MovedItems', '_SixMetaPathImporter', '_LazyModule','_MovedItems','_SixMetaPathImporter','_LazyModule','_MovedItems','_SixMetaPathImporter','作者','内置',' doc ','文件','名称','包','路径','版本','_add_doc','_assertCountEqual','_assertRaisesRegex','_assertRegex','_func_closure','_func_code','_func_defaults','_func_globals','_import_module','_importer','_meth_func','_meth_self', '_moved_attributes', '_print', '_urllib_error_moved_attributes', '_urllib_parse_moved_attributes', '_urllib_request_moved_attributes', '_urllib_response_moved_attributes', '_urllib_robotparser_moved_attributes', 'absolute_import', 'add_metaclass', 'add_move', 'advance_iterator', 'assertCountEqual', 'assertRaisesRegex ','assertRegex','b','binary_type','byte2int','callable','class_types','create_bound_method','exec_','functools','get_function_closure','get_function_code','get_function_defaults','get_function_globals','get_method_function','get_method_self','get_unbound_function','indexbytes','int2byte','integer_types' , 'iterbytes', 'iteritems', 'iterkeys', 'iterlists', 'itertools', 'itervalues', 'moves', 'next', 'operator', 'print_', 'python_2_unicode_compatible', 'raise_from', ' remove_move'、'reraise'、'string_types'、'sys'、'text_type'、'types'、'u'、'unichr'、'viewitems'、'viewkeys'、'viewvalues'、'with_metaclass'、'wraps']。
从上面的输出可以看出,moves
在six
导入时仍然会出错。
在这方面花了很多时间,但到目前为止还没有解决方案,在这里将不胜感激任何帮助。:(
更新1
错误堆栈跟踪:-
python-3.6 - ModuleNotFoundError:没有名为“六”的模块
我正在尝试lamp server
在我的Fedora 27
. 参考这个网站,我正在关注每一步,但是运行这个命令firewall-cmd --permanent --add-service=http
,我得到以下错误
我重新安装six
了软件包,但仍然出现相同的错误消息。
python - PIP 安装不起作用(六、numpy 和 python-dateutil 要求)
我是 Python 的新手,想在 Mac 上为 Python 3.5 安装 Pillow 包。我使用pip install pillow
命令并收到此错误:
所以我继续尝试安装 pandas、html5lib 等似乎需要的所有东西pip install six
,pip install numpy
并pip install python-dateutil
得到下一个错误(对于所有命令都相同):
所以我认为好的六和其他已经在那里,我只需要使用pip install --upgrade six
命令升级它们。这是我得到最后一个错误,现在不知道如何继续:
所以在这里我被困住了,如果你们中的一些人能解决我的问题,我会很高兴:-)
python - 安装有六个依赖的错误
Running setup.py install for anyjson ... done
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-29Cml5-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
错误堆栈跟踪的片段。在 python 上运行 requirements.txt 时。是不是因为六。
忽略它没有帮助。
sudo -H pip install -r requirements.txt --ignore-installed six
Double requirement given: six==1.10.0 (from -r requirements.txt (line 107)) (already in six, name='six')
这篇文章没有帮助 - https://github.com/pypa/pip/issues/3165
python - RKeras“未知的url类型:https”错误六.urlretrieve(来自R的Python代码)
TL;DR :-) 获取 https url 在 python 和 R 中都有效,但在从 R 中运行 python 代码时无效。
在 RKeras 包的文档中运行一些代码时,我反复遇到致命错误:"unknown url type: https"
问题源于用 Python 实现的 Keras。
我深入研究了这个问题,发现这是在 Keras 调用urlretrieve
模块six
中的函数以从 https url 检索数据时发生的。
然后我在 iPython 中测试了代码,发现它运行良好。
然后我尝试在 R 中做同样的事情,但它失败了
但是,同样的事情在 R 中也适用于普通的 http
作为记录,https 在我的 R 中使用 httr 之类的包可以正常工作。
我在这里完全超出了我的深度。会发生什么?
这是关于我的环境的一些输出
回复:
和 Python(从 R 看)
将非常感谢您的时间和精力。
编辑:R中的更多调试信息:
python - 预安全导入模块挂钩后 PyInstaller 最大递归错误 [six.moves]
我正在尝试使用 PyInstaller 将我的 python3.5 项目转换为 .exe 文件我的主文件是 SegTool.py
这是我的 .spec 文件:
也许我对相关的钩子和依赖关系不太了解,但我遇到了崩溃:
回溯之前的输出(DEBUG 和 INFO 已打开):
10923 INFO: Caching module hooks...
10937 INFO: Analyzing SegTool.py
13458 INFO: Processing pre-safe import module hook six.moves
14204 INFO: Processing pre-safe import module hook win32com
14205 DEBUG: win32com: extending __path__ with dir 'C:\\Users\\Keren Meron\\WinPython-64bit-3.5.3.1Qt5\\python-3.5.3.amd64\\lib\\site-packages\\win32comext'
14604 INFO: Processing pre-find module path hook distutils
16281 INFO: Processing pre-find module path hook site
16284 INFO: site: retargeting to fake-dir 'C:\\Users\\Keren Meron\\WinPython-64bit-3.5.3.1Qt5\\python-3.5.3.amd64\\lib\\site-packages\\PyInstaller\\fake-modules'
40968 INFO: Processing pre-safe import module hook requests.packages.urllib3.packages.six.moves
51591 DEBUG: load_module: SyntaxError in 'C:\\Users\\Keren Meron\\WinPython-64bit-3.5.3.1Qt5\\python-3.5.3.amd64\\lib\\site-packages\\jinja2\\asyncsupport.py'
请帮忙,我需要做什么来解决这个问题?
谢谢
python - 点六.add_metaclass 错误
几天前我在使用 pip (1,2 or 3) 安装时开始出现以下错误。
*
*
我一直在研究并尝试解决此问题,但无法缩小问题范围。就在注意到这个问题之前,我已经使用标准存储库更新了我的 debian 系统并且没有任何值得注意的问题,我还使用 pip3 install --update 更新了一些 pip 模块,我相信我更新的模块是 scapy 并且请求我我无法将 pip 用于我尝试过的任何命令,甚至是“pip list”或任何版本的 pip 到 3.6。我已经卸载并重新安装了 pip、virtualenv,并尝试从我的 distutils 文件夹中手动删除 Six.add_metaclass-1.0* 文件夹。我尝试过的任何事情都没有产生任何我能看到的变化,而且我无法缩小我看到的任何问题确实与这个特定问题相似或相关的范围。
python - Python:在 pip install tld 时无法卸载“六”
安装 tld 模块时出现无法卸载现有“六”模块的错误。