简体   繁体   English

pip安装,熊猫,硒,无处不在的Deepcopy错误

[英]Deepcopy Errors in pip install, pandas, selenium, everywhere

I've been recently getting deepcopy errors on my Windows 2008 R2 server running python 2.7. 我最近在运行python 2.7的Windows 2008 R2服务器上收到了Deepcopy错误。

Even a simple pip install -U selenium gives this error 即使是简单的pip安装-U硒也会出现此错误

  Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pip.exe\__main__.py", line 5, in <module>
File "c:\python27\lib\site-packages\pip\__init__.py", line 14, in <module>
from pip.utils import get_installed_distributions, get_prog
 File "c:\python27\lib\site-packages\pip\utils\__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
 File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 71, in <module>
__import__('pip._vendor.packaging.requirements')
 File "c:\python27\lib\site-packages\pip\_vendor\packaging\requirements.py", line 9, in <module>
from pip._vendor.pyparsing import (
File "c:\python27\lib\site-packages\pip\_vendor\pyparsing.py", line 3462, in <module>
_reBracketExpr = Literal("[") + Optional("^").setResultsName("negate") + Group( OneOrMore( _charRange | _singleChar ) ).setResultsName("body") + "]"
File "c:\python27\lib\site-packages\pip\_vendor\pyparsing.py", line 884, in setResultsName
newself = self.copy()
File "c:\python27\lib\site-packages\pip\_vendor\pyparsing.py", line 858, in copy
cpy = copy.copy( self )
 AttributeError: 'module' object has no attribute 'copy'

When I run the command mydriver=webdriver.Firefox() in python shell, I get this error 当我在python shell中运行命令mydriver = webdriver.Firefox()时,出现此错误

Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py",line 51, in __init__
self.profile = firefox_profile or FirefoxProfile()
 File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py", line 67, in __init__
self.default_preferences = copy.deepcopy(
AttributeError: 'module' object has no attribute 'deepcopy'

I get similar errors while importing pandas. 导入熊猫时出现类似错误。

This thing can happen when a copy.py or copy.pyc exists in the folder you run your Python scripts. 当您在运行Python脚本的文件夹中存在一个copy.pycopy.pyc时,可能会发生这种情况。 So when you import copy it actually imports the copy.py in your working directory. 因此,当您import copy它实际上copy.py import copy您的工作目录中。 Make sure don't use copy.py as your filename. 确保不要使用copy.py作为文件名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM