简体   繁体   中英

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. When I try to run a test, it looks like it is still using 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? 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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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