1

I want to import a python module I have off of Github, but I want it to be portable, I.E. available to use on a memory stick, and I want to have it so I don't have to install the module through CMD on every machine I want it to run on.

I've seen Import python package from local directory into interpreter, but none of the answers worked for me, as I don't have a specific file to target, it's a directory I want to import. The module I want to import is (https://github.com/ricmoo/pyaes)

Hugh
  • 47
  • 2
  • 6
  • Note that what you really want to import is the **inner** *pyaes* folder (from *GitHub*). All you have to do is add the the parent dir path (of that **inner** folder - wherever it might be) to the env var *PYTHONPATH*, start *python*, and you should be good. – CristiFati Jan 27 '18 at 18:05

2 Answers2

0

Have you tried from [path to directory] import [whatever you want to import]? That should do the trick.

mtjiran
  • 292
  • 1
  • 2
  • 12
0

Try something like this

import sys
sys.path.append('C:\\Users\\Administrator\\Desktop\\pyaes-master')
import pyaes
Bondeaux
  • 174
  • 1
  • 3
  • 10
  • Which file am I using? Sorry, I'm new to this. Is it the `setup.py`? – Hugh Jan 27 '18 at 18:13
  • You should use 'import pyaes' as you don't want to install it, yes? – Bondeaux Jan 27 '18 at 18:15
  • I have downloaded the pyaes folder from Github and added it like this: `sys.path.append('C:/Users/ted67/Code/encrypt_files/pyaes')` but it doesn't seem to be working? – Hugh Jan 27 '18 at 18:20
  • when I `import pyaes`, it says "No module named pyaes" – Hugh Jan 27 '18 at 18:20