Cześć. Następujący program działa mi z matplotlib:
import matplotlib.pyplot as plt
import numpy as np
skala = np.linspace(0.,1.,3)
B=[1,5,77]
plt.plot(skala, B)
plt.show()
Wyświetla wykres bez problemu. Ale, gdy próbuję uruchomić coś takiego z terminala:
import matplotlib.pyplot as plt
import numpy as np
from sys import argv
key1 = [340282366920938463463374607431768211455,340282366920938463463374607431768211453,340282366920938463463374607431768211451,340282366920938463463374607431768211449,340282366920938463463374607431768211447,340282366920938463463374607431768211445,340282366920938463463374607431768211443,340282366920938463463374607431768211441,340282366920938463463374607431768211439,340282366920938463463374607431768211437] # increments
key2 = [240282366920938463463374607431768211455,240282366920938463463374607431768211453,240282366920938463463374607431768211451,240282366920938463463374607431768211449,240282366920938463463374607431768211447,240282366920938463463374607431768211445,240282366920938463463374607431768211443,240282366920938463463374607431768211441,240282366920938463463374607431768211439,240282366920938463463374607431768211437] # multipliers
r = len(key1) # nmbr of rounds implied by keys
pt = int(argv[1]) # the plaintext
def round(s, key1, key2):
s = s + key1
s = (key2 * s) % 2**128
# here is just XSL-RR-RR mixer (I had to write my own rotr function):
x=s
count1 = x >> 122
x1 = (x ^ (x >> 64)) % (1 << 64)
low64 = (((1 << (64 - count1)) * ((x1 % (1 << count1)) + (1 << count1))) ^ (1 << 64)) + (x1 >> count1)
x2 = (x >> 64) % (1 << 64)
count2 = low64 & 63
high64 = (((1 << (64 - count2)) * ((x2 % (1 << count2)) + (1 << count2))) ^ (1 << 64)) + (x2 >> count2)
s = (high64 << 64) | low64
return s
def encrypt(pt, key1, key2, r):
ct = pt
for i in range(r):
ct = round(ct, key1[i], key2[i])
return ct
n=(encrypt(pt, key1, key2, r)) % 32
skala = np.linspace(0.,1.,3)
B=[1,5,n]
plt.plot(skala, B)
plt.show()
To dostaję błąd:
Traceback (most recent call last):
File "C:\Users\omnia\PycharmProjects\Collatz\Chwilowy.py", line 1, in <module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
I to już przy wczytywaniu biblioteki. O co chodzi?