[英]Importing pandas from a location for version python2.6.6
I installed pandas 0.16.2 using this command 我使用这个命令安装了pandas 0.16.2
pip install --target /myfolder [packages] pip install --target / myfolder [packages]
Now, i want to write a python script to import pandas from the /myfolder 现在,我想写一个python脚本从/ myfolder导入pandas
My code 我的代码
import imp
pd =imp.load_source('pandas.name','/mnt/gfsusr/software/python_modules/pandas')
pd
I expect that the pd variable above contains all the methods of pandas. 我希望上面的pd变量包含pandas的所有方法。
import sys
sys.path.append('/mnt/gfsusr/software')
from python_modules import pandas as pd
The code above will extend the sys path to include the file you want to import. 上面的代码将扩展sys路径以包含要导入的文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.