Search code examples
pythonpython-3.xpyenv

pyenv using right python version but using wrong libraries folder


Hello I currently run on 3.8 python. I need to execute a 3.6 version script that uses the Crypto and time libraries. So I installed pyenv and pyenv-virtualenv. I installed the version of python I wanted : pyenv install 3.6.8. Then I went to my project folder cd Documents/CSC/myProject/. I executed : pyenv local 3.6.8. I verified the pip version : pip 18.1 from /home/alex/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pip (python 3.6) . That was okay. Then I installed Crypto on the 3.6 version. But when I run the script I have the following error: File "/usr/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 77, in collect t = time.clock() AttributeError: module 'time' has no attribute 'clock' Why does python search the 3.8 version of Crypto even if I have the 3.6 version on local. When I am in the folder the 3.6 version ? I'm a bit confused. Thanks for your help :)


Solution

  • Not sure whats causing the problem but i would suggest you to pipenv instead. It is more reliable and simpler in my personal opinion You can install it using pip install pipenv and then do pipenv shell to use it. Read more about it here