ImportError:' random':b' \ x03 \ xf3 \ r \ n'中的错误幻数

时间:2017-05-16 21:29:04

标签: python python-3.x matplotlib anaconda

当我创建一个anaconda virtualenv并在其中安装pip时,它似乎遇到错误,这可能表明它使用python 2?

conda create -n tensorflow-3.5 python=3.5 ipykernel
source activate tensorflow-3.5
pip install matplotlib
(tensorflow-3.5) devs-MacBook-Pro:Documents conduce-laptop$ python
Python 3.5.3 |Continuum Analytics, Inc.| (default, Mar  6 2017, 12:15:08) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/conduce-laptop/anaconda2/envs/tensorflow-3.5/lib/python3.5/site-packages/matplotlib/__init__.py", line 115, in <module>
    import tempfile
  File "/Users/conduce-laptop/anaconda2/envs/tensorflow-3.5/lib/python3.5/tempfile.py", line 45, in <module>
    from random import Random as _Random
ImportError: bad magic number in 'random': b'\x03\xf3\r\n'

为什么会这样?我应该如何安装模块呢?我需要使用pip3吗?

0 个答案:

没有答案