查看python包所在位置

C:\Users\liuxiang15>python -c "import numpy; print numpy.__file__"
  File "<string>", line 1
    import numpy; print numpy.__file__
                            ^
SyntaxError: invalid syntax

C:\Users\liuxiang15>python -c "import numpy; print( numpy.__file__)"
D:\softwares\lib\site-packages\numpy\__init__.py

C:\Users\liuxiang15>python -c "import math; print(math.__file__)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'math' has no attribute '__file__'

C:\Users\liuxiang15>python -c "import operator; print(operator.__file__)"
D:\softwares\lib\operator.py

C:\Users\liuxiang15>python -c "import time; print(time.__file__)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'time' has no attribute '__file__'
C:\Users\liuxiang15>python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', 'D:\\softwares\\python36.zip', 'D:\\softwares\\DLLs', 'D:\\softwares\\lib', 'D:\\softwares', 'D:\\softwares\\lib\\site-packages', 'D:\\softwares\\lib\\site-packages\\win32', 'D:\\softwares\\lib\\site-packages\\win32\\lib', 'D:\\softwares\\lib\\site-packages\\Pythonwin']
>>> math.__file__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'math' is not defined
>>> import math
>>> math.__file__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'math' has no attribute '__file__'
>>> math.__path__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'math' has no attribute '__path__'
>>> sys.time
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'sys' has no attribute 'time'
>>> import sys
>>> sys.time
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'sys' has no attribute 'time'
发布了63 篇原创文章 · 获赞 18 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/liuxiang15/article/details/88646261