anaconda安装shapefile_如何向Anaconda添加模块

本文介绍了如何在Anaconda环境中安装和使用Python模块。提供了多种安装方式,包括使用conda、pip以及通过setup.py文件进行安装的方法。同时解答了在不同环境中模块路径差异的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

This is what i get when i do "python -V"

Python 2.7.11 :: Anaconda 2.4.0 (64-bit)

I usually use my terminal to play with IDLE.But now i have also installed IDLE shell.

I tried import sys;sys.path on both.They throw different paths.

My Terminal returned the path with anaconda in it.

I tried to install a module following these steps.

python setup.py sdist

sudo python setup.py install

Then i opened IDLE(shell).I was able to import and also use my module.

I wanna do the same in Anaconda..I tried using conda install filename.py.It doesn't work.

Please help.

解决方案

There are several ways to add a module to Anaconda.

conda install

pip install

python setup.py install (if you are in the source directory, no sudo required if anaconda is in your home directory)

To make a package for others to use you will need to put it up where people can access it like Github.

You will have to make a config file (takes yaml file manipulation) you can read up on how to make/distribute packages here. http://conda.pydata.org/docs/build_tutorials/pkgs.html

Now to answer your question: There is a difference between using a file and using a module/package. A file can just be imported in another python program using import filename where filename.py is the name of the file you want to use. to make that a module you want to take a look at the answer to this question. How to write a Python module?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值