简体   繁体   中英

Import a folder as package in python

I am using a linux server, but I don't have permission to install packages with pip , so I download the package I need : tsfresh from https://github.com/blue-yonder/tsfresh , and then using ftp upload the unpacked folder I downloaded to the Linux server, but how do I import tsfresh ??

I put the download folder in the path /upload/tsfresh , and my python working directory is in /upload/ .

The following is the sub-folder of my folder upload

./tsfresh
./tsfresh/.github
./tsfresh/binder
./tsfresh/docs
./tsfresh/notebooks
./tsfresh/tests
./tsfresh/tsfresh
./tsfresh/docs/api
./tsfresh/docs/images
./tsfresh/docs/text
./tsfresh/docs/_static
./tsfresh/docs/_templates
./tsfresh/tests/integrations
./tsfresh/tests/units
./tsfresh/tests/integrations/examples
./tsfresh/tests/units/feature_extraction
./tsfresh/tests/units/feature_selection
./tsfresh/tests/units/scripts
./tsfresh/tests/units/transformers
./tsfresh/tests/units/utilities
./tsfresh/tsfresh/convenience
./tsfresh/tsfresh/examples
./tsfresh/tsfresh/feature_extraction
./tsfresh/tsfresh/feature_selection
./tsfresh/tsfresh/scripts
./tsfresh/tsfresh/transformers
./tsfresh/tsfresh/utilities

My question is : How do I import the tsfresh as a normal package.

It's in your project folder, right? Then

import tsfresh

Will work if it has an init.py to make it a module.

If its not in that folder, append it to sys.path

Or just get your admin to install it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM