簡體   English   中英

python3 使用 Pandas 可以在 IDE 上運行,但不能在程序中運行

[英]python3 using pandas works on IDE but not in program

從終端執行代碼時出現此錯誤:

AttributeError: module 'pandas' has no attribute 'Series'

從這個代碼:

import pandas
numbers = {1,2,3,4,5}
ser = pandas.Series(list(numbers))
print(ser)

但相同的代碼在 IDE 中運行良好

Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>> numbers = {1,2,3,4,5}
>>> ser = pandas.Series(list(numbers))
>>> ser
0    1
1    2
2    3
3    4
4    5
dtype: int64

系統路徑:

['C:\\Users\\norman.khine\\Documents\\CodeCommit\\sysadmin\\scripts', 'C:\\Python36\\python36.zip', 'C:\\Python36\\DLLs', 'C:\\Python36\\lib', 'C:\\Python36', 'C:\\Users\\norman.khine\\AppData\\Roaming\\Python\\Python36\\site-packages', 'C:\\Python36\\lib\\site-packages', 'C:\\Python36\\lib\\site-packages\\whois-0.1-py3.6.egg']

所有其他模塊都正確導入!

有什么幫助嗎?

將腳本名稱更改為ssl.py以外的ssl.py解決了這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM