python shell打不开_无法执行python脚本或转到python shell

I can not run my Python script or even run command Python to go to python shell. What's wrong with my Python?

machine:project user$ python

Traceback (most recent call last):

File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 62, in

import os

File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 398, in

import UserDict

File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py", line 83, in

import _abcoll

File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_abcoll.py", line 11, in

from abc import ABCMeta, abstractmethod

File "abc.py", line 2, in

import scipy.special

File "/Library/Python/2.7/site-packages/scipy/__init__.py", line 70, in

from numpy import show_config as show_numpy_config

File "/Library/Python/2.7/site-packages/numpy/__init__.py", line 153, in

from . import add_newdocs

File "/Library/Python/2.7/site-packages/numpy/add_newdocs.py", line 13, in

from numpy.lib import add_newdoc

File "/Library/Python/2.7/site-packages/numpy/lib/__init__.py", line 8, in

from .type_check import *

File "/Library/Python/2.7/site-packages/numpy/lib/type_check.py", line 11, in

import numpy.core.numeric as _nx

File "/Library/Python/2.7/site-packages/numpy/core/__init__.py", line 11, in

from . import numeric

File "/Library/Python/2.7/site-packages/numpy/core/numeric.py", line 5, in

import collections

File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/collections.py", line 6, in

__all__ += _abcoll.__all__

AttributeError: 'module' object has no attribute '__all__'

But anyway everything still looks fine if run Python outside my project directory.

解决方案

You have a local file called abc.py which is hiding the built-in abc module. Rename your file to something else.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值