简体   繁体   English

升级至Python3的问题

[英]Problems with Upgrade to Python3

I updated my Mac to Python 3.4.3, I changed my interpreter in PyCharm to be Python 3.4.3. 我将Mac更新为Python 3.4.3,在PyCharm中将解释器更改为Python 3.4.3。 When I try to run a test, it looks like it is still using Python 2.7. 当我尝试运行测试时,看起来它仍在使用Python 2.7。

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py", line 331, in run
    testMethod()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/Users/curtis.salisbury/Documents/local_copy/trunk/automation/selenium/src/tests/framework/test_ddt.py", line 4, in <module>
    from .base_framework import BaseFramework
  File "/Users/curtis.salisbury/Documents/local_copy/trunk/automation/selenium/src/tests/framework/base_framework.py", line 2, in <module>
    from tests.base_test_case import BaseTestCase
  File "/Users/curtis.salisbury/Documents/local_copy/trunk/automation/selenium/src/tests/base_test_case.py", line 7, in <module>
    import http.client
ImportError: No module named http.client

What am I missing here to make this work in Python 3? 我想在Python 3中实现此功能的地方是什么? I tried using an alias in terminal and when I do that, the interpreter changes to Python 3, however, when I run in PyCharm, it goes back to the 2.7? 我尝试在终端中使用别名,当这样做时,解释器更改为Python 3,但是,当我在PyCharm中运行时,它可以回到2.7吗?

我进入“编辑配置”,由于某种原因,那里的解释器仍然是Python2。我将其更改为3,并且效果很好。

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

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